|
|
|
Grasshopper
      
Group: General Forum Members
Last Login: Yesterday @ 7:39 PM
Points: 20,
Visits: 264
|
|
|
|
|
|
SSC Journeyman
      
Group: General Forum Members
Last Login: Wednesday, February 06, 2013 1:16 PM
Points: 89,
Visits: 289
|
|
trying to save this as a stored procedure in SQL2005, but am getting an error: Cannot assign a default value to a local variable.
Any help is greatly appreciated, thanks!
|
|
|
|
|
Grasshopper
      
Group: General Forum Members
Last Login: Yesterday @ 7:39 PM
Points: 20,
Visits: 264
|
|
sql 2005 does not allow assigning values to a variable during declaration. You can have the declare done first and then assign the values to the declared variables. I have not tested this script on sql 2005, I do not have one setup. If things do not work as a complete package in sql 2005 you can get rid of the pieces that does not work and use the rest if you'd like.
|
|
|
|
|
Grasshopper
      
Group: General Forum Members
Last Login: Yesterday @ 7:39 PM
Points: 20,
Visits: 264
|
|
A sample if you need it
--SQL2008++ DECLARE @i INT = 5, @k INT = 6 GO --SQL2005++ DECLARE @i INT, @k INT
SELECT @i = 5, @k = 6 GO -- SQL2005++ DECLARE @i INT, @k INT
SET @i = 5 SET @k = 6
|
|
|
|
|
SSC Journeyman
      
Group: General Forum Members
Last Login: Wednesday, February 06, 2013 1:16 PM
Points: 89,
Visits: 289
|
|
when trying to copy and paste this script into my SQL manager studio, it gives me a ton of "Incorrect syntax near ' '." errors due to the characters spaces in each line. Am I copying this wrong from the site, or is there an easier way to remove these so the script will run?
thanks!
|
|
|
|
|
Grasshopper
      
Group: General Forum Members
Last Login: Yesterday @ 7:39 PM
Points: 20,
Visits: 264
|
|
| try to copy and paste into word first and then paste it to notepad to see if the off characters are removed then copy it to management studio.
|
|
|
|