SQL Query
-
Hi all I have table like Table1 ID Status Flaged 1 NotApproved 1 2 NotApproved 0 3 NotApproved NUll 4 NotApproved NULL here i need to get the ID in which status=NotApproved and Flaged <>1 so the result should be like this 2 NotApproved 0 3 NotApproved NUll 4 NotApproved NULL i should get these 3 records.... hw will write the query?...how to pass the parameters? thanks
-
Hi all I have table like Table1 ID Status Flaged 1 NotApproved 1 2 NotApproved 0 3 NotApproved NUll 4 NotApproved NULL here i need to get the ID in which status=NotApproved and Flaged <>1 so the result should be like this 2 NotApproved 0 3 NotApproved NUll 4 NotApproved NULL i should get these 3 records.... hw will write the query?...how to pass the parameters? thanks
Hi, You can write query as follows : select * from Table1 where status='NotApproved' and Flaged NOT LIKE ('1') assuming that both status and flaged field are of varchar data-type.
Regards, Ujjaval Modi :) Manpower moves wrenches, horsepower moves cars, and the power of the mind moves the world.
-
Hi, You can write query as follows : select * from Table1 where status='NotApproved' and Flaged NOT LIKE ('1') assuming that both status and flaged field are of varchar data-type.
Regards, Ujjaval Modi :) Manpower moves wrenches, horsepower moves cars, and the power of the mind moves the world.
-
Hi, that is working when am calling directly in the code....but here i need ta call that as storedprocedure....so i have created that as stored procedure to fill a dropdown... my doubt is how to pass this 'flaged' as parameter...(second parameter) here is my code:- Sub FillRID() Try Initialize("StoredProcedure", "SelectRequestID1new") _cmd.Parameters.Add(New SqlParameter("@ApprovedStatus", "NotApproved")) _cmd.Parameters.Add(New SqlParameter("@Flaged", "")) _dr = _cmd.ExecuteReader() DropDownRID.DataSource = _dr DropDownRID.DataTextField = "ID" DropDownRID.DataValueField = "ID" DropDownRID.DataBind() DropDownRID.Items.Insert(0, "Select RequestID") DropDownRID.SelectedIndex = 0 Catch ex As Exception End Try End Sub
-
Hi, that is working when am calling directly in the code....but here i need ta call that as storedprocedure....so i have created that as stored procedure to fill a dropdown... my doubt is how to pass this 'flaged' as parameter...(second parameter) here is my code:- Sub FillRID() Try Initialize("StoredProcedure", "SelectRequestID1new") _cmd.Parameters.Add(New SqlParameter("@ApprovedStatus", "NotApproved")) _cmd.Parameters.Add(New SqlParameter("@Flaged", "")) _dr = _cmd.ExecuteReader() DropDownRID.DataSource = _dr DropDownRID.DataTextField = "ID" DropDownRID.DataValueField = "ID" DropDownRID.DataBind() DropDownRID.Items.Insert(0, "Select RequestID") DropDownRID.SelectedIndex = 0 Catch ex As Exception End Try End Sub