SQL query to find rows that contain only numerical data
Table fields are ID and Value
Select value from tblname where ISNUMERIC(value)=1
To fetch ALTERNATE records from a table. (EVEN NUMBERED nd odd NUMBERED)
Select * from Images where (ID % 2) = 1 odd
Select * from Images where (ID % 2) = 0 even
What is recursive stored procedure?
SQL Server supports recursive stored procedure which calls by itself. Recursive stored procedure can be defined as a method of problem solving wherein the solution is arrived repetitively. It can nest up to 32 levels.
Given a table TBL with a field Nmbr that has rows with the following values: 1, 0, 0, 1, 1, 1, 1, 0, 0, 1, 0, 1, 0, 1, 0, 1
Write a query to add 2 where
What is the difference between UNION and UNION ALL?
UNION statement is mainly used to combine the tables including the duplicate rows and UNION ALL combine but does not look for duplicate rows. With this, UNION ALL will be very faster than UNION statements.
Write a query to add 2 where Nmbr is 0 and add 3 where Nmbr is 1.
update TBL set Nmbr = case when Nmbr=0 then 2 when Nmbr=1 then 3 end
What is the use of SET NOCOUNT ON/OFF statement?
By default, NOCOUNT is set to OFF and it returns number of records got affected whenever the command is getting executed. If the user doesn’t want to display the number of records affected, it can be explicitly set to ON- (SET NOCOUNT ON).
0 comments:
Post a Comment