MS-SQL Server querry question
-
In table i have column that is type of varchar(n), and it's not primary/foreign key. Now, what I need is SQL query (stored procedure) that will select all the records in that table like: (pseudo) select * from table1 where SUBSTRING(table1.column2,1,2)<@param1 and SUBSTRING(table1.column2,1,2)>@param2 Parameters are first two letters of any record that contains data for that column. if param1 is aa and param2 is cc then output should be all the records with first two letters like: aa,ab,ac,...,az,ba,..,bz,ca,cb,cc Any suggestions would be appreciated!
-
In table i have column that is type of varchar(n), and it's not primary/foreign key. Now, what I need is SQL query (stored procedure) that will select all the records in that table like: (pseudo) select * from table1 where SUBSTRING(table1.column2,1,2)<@param1 and SUBSTRING(table1.column2,1,2)>@param2 Parameters are first two letters of any record that contains data for that column. if param1 is aa and param2 is cc then output should be all the records with first two letters like: aa,ab,ac,...,az,ba,..,bz,ca,cb,cc Any suggestions would be appreciated!
First off, I think you have your signs backward. Other than that, have you tried it?
-
First off, I think you have your signs backward. Other than that, have you tried it?
-
In table i have column that is type of varchar(n), and it's not primary/foreign key. Now, what I need is SQL query (stored procedure) that will select all the records in that table like: (pseudo) select * from table1 where SUBSTRING(table1.column2,1,2)<@param1 and SUBSTRING(table1.column2,1,2)>@param2 Parameters are first two letters of any record that contains data for that column. if param1 is aa and param2 is cc then output should be all the records with first two letters like: aa,ab,ac,...,az,ba,..,bz,ca,cb,cc Any suggestions would be appreciated!