Friday, February 24, 2012

how to find Data Type of a Declared Variable

how to find Data Type of a Declared Variable in sql server?
i googled a lot but could not find ans.
suppose
Declare @.Var1 int
now i want to find datatype of @.var1.
plz help.Hi Amit
Can you explain why you need to do this?
Variables are extremely local in SQL Server; they have no existence outside
the batch where they are declared. So you can never see or use, much less
find out the datatype, from any variable in any other batch. For variables
in the current batch, whoever wrote the batch has to define them so why
wouldn't that information be available?
--
HTH
Kalen Delaney, SQL Server MVP
www.InsideSQLServer.com
http://sqlblog.com
"amit sharma" <amit sharma@.discussions.microsoft.com> wrote in message
news:A07C1CC0-B0C2-4D98-80C7-DEDB221FC783@.microsoft.com...
> how to find Data Type of a Declared Variable in sql server?
> i googled a lot but could not find ans.
> suppose
> Declare @.Var1 int
> now i want to find datatype of @.var1.
> plz help.
>|||Typing and variables are relatively insignificant in sql. They are so
alien that MS has tried to create a bypass for programmers who think
in such terms. I suggest you look at LINQ to Sql for a way to make
sql understandable and workable in a natural programming enivornment.
www.beyondsql.blogspot.com

No comments:

Post a Comment