November 21, 2012 at 9:33 am
Hi,
I am getting trouble to pass the value of column2 to of my table in SQL stored procedure from .net application (vb.net) and same to compare the input variable's value in the stored procedure,
create table table_name(
column1nchar(50)
,column2timestamp
)
in detail, the data would be like this.
select top 1 column2 from table_name
The Result:
"0x00000000009CEB4F"
the query would be like this:
declare @variable nvarchar(max)
set @variable ='0x00000000009CEB4F'
select *
from table_name
where column2=@variable
can any one please throw a light on my issue , how can I overcome that,
any help is much appriciated.
Thanks,
Siva
November 21, 2012 at 9:36 am
How can you overcome what? What exactly is the problem?
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
November 21, 2012 at 9:45 am
timestamp is poorly named; the correct datatype name is rowversion.
it's storing a number in there , not an nvarchar or varchar.
you could change your variable to be int, bigint, or varbinary to get the resutls you expect.
declare @variable int
set @variable =0x000000000002F5D1
select *
from table_name
where column2=@variable
insert into table_name(column1) VALUES('example')
/*
ccolumn1column2 (No column name)
example 0x000000000002F5D1194001
*/
select *, convert(int,column2)
from table_name
Lowell
November 22, 2012 at 12:16 am
Hi Gila,
Thanks for your effort to read my post, but the issue which I thought to overcome, has been suggested by lowell.
Thanks again,
Prabhu...
November 22, 2012 at 12:17 am
Hi Lowell,
yes, I tested the Idea which you suggested and found it is working, thanks for your valued time,
Thanks,
Prabhu...(siva)
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply