x

TSQL QUERY

Hi Experts ,My developer write below TSQL query and asked me to review it . what steps should i take ?and how i do i test it ?

 BEGIN
     INSERT INTO nsConfig (MachineName, PropertyName, PropertyValue) 
         VALUES ('*', 'PurgeDocumentsBatchSize', '1000');
 END
 
     IF NOT EXISTS(
         SELECT * FROM sys.schemas s 
         INNER JOIN sys.tables t ON s.schema_id = t.schema_id
         INNER JOIN sys.columns c ON t.object_id = c.object_id
         WHERE s.name = 'dbo' AND t.name = 'nsTransactionProperties' AND c.name = 'ToBePurgedDate'
     )
     BEGIN
         ALTER TABLE nsTransactionProperties ADD ToBePurgedDate DATETIME NULL;
     END
 
     IF NOT EXISTS(
         SELECT * FROM sys.schemas s 
         INNER JOIN sys.tables t ON s.schema_id = t.schema_id
         INNER JOIN sys.columns c ON t.object_id = c.object_id
         WHERE s.name = 'dbo' AND t.name = 'nsPDFDocument' AND c.name = 'PurgedDocumentHash'
     )
     BEGIN
         ALTER TABLE nsPDFDocument ADD PurgedDocumentHash VARBINARY(MAX) NULL;
     END
 END


thanks

more ▼

asked Feb 13 at 10:01 PM in Default

avatar image

shamim007
210 6

(comments are locked)
10|1200 characters needed characters left

0 answers: sort voted first
Be the first one to answer this question
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

SQL Server Central

Need long-form SQL discussion? SQLserverCentral.com is the place.

Topics:

x2159
x428

asked: Feb 13 at 10:01 PM

Seen: 48 times

Last Updated: Feb 13 at 10:01 PM

Copyright 2017 Redgate Software. Privacy Policy