March 3, 2011 at 4:46 am
i am Beginner in sql server.so any can help to me.
DECLARE @ INT
SET @=20
PRINT @
output
20
I Didn't Given any variable,even though it displaying output
why it happened?
AND
Is it possible to declare global variables by user and i need scope is global or entire window
is it global variable?
DECLARE @@intNo INT
SET @@intNo=20
PRINT @@intNo
March 3, 2011 at 5:10 am
no you cannot set any value in global variable.there values are dependent on previous statement's execution status like @@rowcount,@@trancount,@@error etc
-------Bhuvnesh----------
I work only to learn Sql Server...though my company pays me for getting their stuff done;-)
March 3, 2011 at 5:30 am
roj87 (3/3/2011)
i am Beginner in sql server.so any can help to me.DECLARE @ INT
SET @=20
PRINT @
output
20
I Didn't Given any variable,even though it displaying output
why it happened?
In this case, @ is the variable
Is it possible to declare global variables by user and i need scope is global or entire window
is it global variable?
DECLARE @@intNo INT
SET @@intNo=20
PRINT @@intNo
You cannot declare global variables in sql server. However, SQL Server uses a set of "global variables". They are actually system functions. You can however use global temporary tables.
Read these:
http://msdn.microsoft.com/en-us/library/ms187953.aspx
http://msdn.microsoft.com/en-us/library/ms187786.aspx
http://weblogs.sqlteam.com/mladenp/archive/2007/04/23/60185.aspx
- arjun
https://sqlroadie.com/
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply