By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,363 Members | 2,417 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,363 IT Pros & Developers. It's quick & easy.

how to get the row count value

P: 375

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='352022000637171'

select @str='declare @count nvarchar(10);select @count=count(*) from '+@t1+' where unit_no=''352022000637171'';select @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
Jun 4 '08 #1
Share this Question
Share on Google+
1 Reply

Expert 5K+
P: 8,127
have you tried using SELECT INTO Statement ?
Jun 4 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.