Hi,
I have to insert a row in a table and update in another table if it already exists.
Infact i have to find out if there are any rows inside the second table , if exists then update, else insert
declare @count nvarchar(10)
declare @maxdattime datetime
declare @UnitNo nvarchar(50)
declare @t1 nvarchar(50)
declare @str nvarchar(1000)
set @t1='gpsdata'
set @UnitNo='352022 000637171'
select @str='declare @count nvarchar(10);se lect @count=count(*) from '+@t1+' where unit_no=''35202 2000637171'';se lect @count'
print @str
exec ( @str)
I have given the table name as a variable, because i have to get that too.
Its just a part of the original sp
Now i want to have the count value
How do i get it
Kindly help
regards
cmrhema
I have to insert a row in a table and update in another table if it already exists.
Infact i have to find out if there are any rows inside the second table , if exists then update, else insert
declare @count nvarchar(10)
declare @maxdattime datetime
declare @UnitNo nvarchar(50)
declare @t1 nvarchar(50)
declare @str nvarchar(1000)
set @t1='gpsdata'
set @UnitNo='352022 000637171'
select @str='declare @count nvarchar(10);se lect @count=count(*) from '+@t1+' where unit_no=''35202 2000637171'';se lect @count'
print @str
exec ( @str)
I have given the table name as a variable, because i have to get that too.
Its just a part of the original sp
Now i want to have the count value
How do i get it
Kindly help
regards
cmrhema
Comment