I have seen many examples and notes where people state you can do the following:
INSERT INTO DatesTable
SELECT DateAdd(day, 1, MAX(DatesTable.Dates)) from DatesTable
GO 10
GO n times I hear is a valid way of looping in SQL - but it doesn't work and SQL Server Management Studio doesn't allow it.
Am I doing something wrong or is there a setting I'm not aware of? And if it cannot be done, what is the simplistic alternative.
Cheers for confirming its valid people. I found the reason why it didnt want to work - GO simply wants another statement after it so I did a select to see its worked and it allows it all to run - simple and useful.
INSERT INTO DatesTable SELECT DateAdd(day, 1, MAX(DatesTable.Dates)) from DatesTable
GO 10
SELECT * FROM DatesTable
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With