Link to home
Start Free TrialLog in
Avatar of akohan
akohan

asked on

defining a variable in stored procedure in SQL Server and MySQL

Hello,

I'm looking at http://mikehillyer.com/articles/managing-hierarchical-data-in-mysql/
and since I'm using SQL Server so need to know what is the equivalent of
SELECT @myRight := rgt FROM nested_category
--WHERE name = 'TELEVISIONS';

Open in new window


in SQL Server.

Thanks,
ak
ASKER CERTIFIED SOLUTION
Avatar of plummet
plummet
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of akohan
akohan

ASKER

right ... thank you!

do we have any things like format specifier as we have in C?
sprintf("some string %i , %s", intVar1, StringVar2);

Any idea?

Thanks.
You just have the SQL print command but you can concatenate strings with a +

eg

Print 'This is the result: ' + @myRight
SOLUTION
Avatar of lludden
lludden
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of akohan

ASKER

Thanks.
Hi Akohan

I kind of thought my solution was the one that helped with your original question, but no points? :-(
Avatar of akohan

ASKER

I see! how can I fix it?

Thanks for letting me know.