Posts

Showing posts with the label SQL Server-2008

Get the SQL Server Information from Query

Some times we need to get the information of the SQL Server where it is installed. Simply we can get the info from Query also -- Get the version info select @@version We have a in-built stored procedure called 'xp_msver' to the Server information. -- Get the Server Information exec xp_msver This is a basic information provided but may be useful to the SQL Server learners . Good day :-)

How to update Row which is not having Primary Key?

We all find some different scenario where the table has no primary key column and need to update the records having same data. For this type of scenario's we need to update the particular column based on some Unique value.In SQL Server we have a option called " ROW_NUMBER() " .Every one know about Row_Number() I will present a brief intro about this. ROW_NUMBER():   ROW_NUMBER to find the Row number of a particular column if its specified in orderby Clause.It has the following syntax  Syntax: select  row_number() over (order by name) as ROWNumber, Name from sys.all_objects order by name  For more details about the R OW_NUMBER() refer this MSDN .   Here I will present a example query to update a table which has no primary key and having same data for few rows . WITH Record AS (select  row_number() over (order by [columnName]) as ROWNumber, Name from sys.all_objects order by name )  UPDATE Record set [col1]=@col1,[co...