Wednesday, August 19, 2009

T-SQL Using GO for Running a Query Multiple Times

Starting in SQL 2005 you can use GO to run a query multiple times. For example, this query will insert the date into the DateCreated column 10 times: CREATE TABLE dbo.TestTable(ID INT IDENTITY (1,1), DateCreated datetime) INSERT INTO dbo.TestTable (DateCreated) VALUES (GetDate()) GO 10 Reference: http://www.mssqltips.com/tip.asp?tip=1216

No comments:

Post a Comment