问题描述:

I have a scenario where i need to validate each individual row values from a column so as to validate further in stored procedure. V do this in c# using arrays.

ex:

string[] name=new string[2]{"Sachin","Rahul"};

f_name=name[0];l_name=name[1];

Like the above example i would like to do in sql server 2008. I have a sample snippet below.

create procedure SP_pop_time(@date1 datetime,@date2 datetime)

as

begin

select distinct dev_token from tbl_fb_pushnote

/* so after getting the distinct values i need to validate with each and every record from the resultant select statement*/like

select count(dev_token1) from tbl

where cr_date between @date1 and @date2

and time between 'time1' and 'time2'

here dev_token1 is the first record from the select statement. Also i need to use looping for validating each and every record.

When I surf for help, @@rownumber and @@rowversion may fit into my scenario. but I don't know how to use it.

Any help ll be appreciated. thx.

相关阅读:
Top