Monday, July 1, 2013

[T-SQL] Move Log file

[T-SQL] Move Log file


Move Log file

Posted: 01 Jul 2013 12:28 AM PDT

Hi,I have data file and log file at different location.data file at location:D:\Folder1\test.mdfwhile log file at place D:\folder2\test_log.ldfNow I want to move this log file to D\folder1\test_log.ldfHow can I achieve this?

Top One by one

Posted: 30 Jun 2013 09:04 PM PDT

Hi All,I have a list of 800000+ records. Now I want to see if someone selects 1 he will get top 10000 records again if he selects 2 then he will able to see next 10000 records (from 10,001 to 20,001) and so on....How will I write this query?

Query suggestion

Posted: 30 Jun 2013 05:09 PM PDT

I have a table A (VoucherNo) and table B (VoucherNo, ModifiedDate)What I want is whenever any voucherno gets inserted in table A, I have to modify the column modifydate of table B with current date as table B contains all the vouchers list in column voucherno...Please suggest me way to achive this..

compare SQL syntax but need the total and %???

Posted: 30 Jun 2013 06:32 PM PDT

Hello SQL GuRu's,A few weeks ago I asked the following (http://www.sqlservercentral.com/Forums/Topic1459631-150-1.aspx?Update=1). For this I had received a clear answer and a good syntax that works nicely. Only I wish now that he takes the total of the syntax (item_keya) and is already compare network name. From the number of devices that come there must be a number of per cent will be given of how many devices are not seen in the database.Here again my syntax;SELECT snetworkname, REPLACE(sNetworkName,'.noc','') FROM WhatsUp.dbo.NetworkInterface RIGHT OUTER JOIN WhatsUp.dbo.device ON WhatsUp.dbo.NetworkInterface.nNetworkInterfaceID = whatsup.dbo.device.nDefaultNetworkInterfaceIDWHERE REPLACE(sNetworkName,'.noc','') NOT IN (SELECT REPLACE(item_keya,'.noc','') AS snetwork FROM dbo.item WHERE item_keya IS NOT NULL AND item_keya <> '') It so my total (item_keya) and that he looks what devices not found in the database to give a percentage number.

Running Dynamic SQL

Posted: 30 Jun 2013 04:38 AM PDT

Hi All, I have in the past created dynamic SQL in a tally table and looped through to execute it. This is probably not best practice but what alternatives are there, apart from cursors and/or while loops that could be used in this instance?Thanks for your thoughts

Help on triggers

Posted: 30 Jun 2013 02:52 AM PDT

Dear Friend,Am I able to capture the query inside the trigger that I was executed..?For example, I have instead of delete trigger for a table say SampleTable.[code="sql"] create table sampletable (Id int ,name varchar(800)) create trigger sampletriger on sampletable instead of delete as Print 'Desired Query' insert into sampletable values(1, 'heavenguy') insert into sampletable values(2, 'tristan') insert into sampletable values(3, 'Jack') [/code]Now i'm trying to delete the sampletable...[code="sql"]delete from sampletable where id = 1[/code]I wanted the trigger to return the query that I executed...output:-delete from sampletable where id = 1

No comments:

Post a Comment

Search This Blog