System proc sp_SysInfo to get

  • Comments posted to this topic are about the item System proc sp_SysInfo to get

  • 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!

  • 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.

  • 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

  • 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!

  • 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.

  • Thanks for the script.

Viewing 7 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic. Login to reply