Have table with values refl value have parametres like : I want to select all data which is in refl to another value declare @val nvarchar(4000) . Is it possible ? When I try select @val = refl from #tbl it select only last row, I want to select all rows. How do it? It must be like Answer Try
Tag: sql
How to convert varchar column values into int?
I have a column toysid which is of varchar datatype in one table. Also another table having same the column toysid with int datatype (I know I can modify column for first table but I have to follow some procedure to keep it as varchar). I have written following query to join the table: The query returns error…
Avoid duplicates rows which have one different column value in SQL Server
I have a view like this . I’m using SQL Server. formId name mark 100 Rob N 101 Rob N 101 Rob C 105 Jane N 106 Jane N view name: …
PHP Return ID[uniqueidentifier] after sql INSERT
Like the title says, I want the id of a row to be returned after INSERT to the database. I’ve got 2 functions, one to make a connection to the database: And one to insert a new record: I need the last function to return the ID of the inserted row, how should I do this? EDIT: Like the title
TRY/CATCH block vs SQL checks
Shortly, I am wondering which of the following is the better practice: to encapsulate my code in TRY/CATCH block and display the error message to write own checks and display custom error messages As I have read the TRY/CATCH block is not handling all types of errors. In my situation this is not an issue. I a…
Counting number of joined rows in left join
I’m trying to write an aggregate query in SQL which returns the count of all records joined to a given record in a table; If no records were joined to the given record, then the result for that record should be 0: Data My database looks like this (I’m not able to change the structure, unfortunatel…
Insert Data Into Temp Table with Query
I have an existing query that outputs current data, and I would like to insert it into a Temp table, but am having some issues doing so. Would anybody have some insight on how to do this? Here is an example This seems to output my data currently the way that i need it to, but I would like to
Nth max salary in Oracle
To find out the Nth max sal in oracle i’m using below query But According to me by using the above query it will take more time to execute if table size is big. i’m trying to use the below query but not getting output.. any suggetions please .. Please share any link on how to optimise queries and …
Explanation of the query for getting the 3 maximum salaries
Can any one explain the below query for getting the 3 maximum salaries? Someone suuggested to me the use of the above query to get 3 max. salaries in a table. I didn’t understand what is happening in the below part of the query: Can anyone explain it? if there is any other way to get the same result,ple…
Call the maximum from SQL table to textbox
I am working on a Windows Forms C# application and I need to auto generate my invoice number from my database. For that I need to get the maximum value from the database and want to add one with the max value in db, any idea Answer You could design your database table using an IDENTITY column. The database wi…