Bharath Radhekrishna

Archive for the ‘Sql server’ Category

Updating column values at once in sqlserver

Posted by: onetidbit on: November 25, 2008

Here the query looks like:
Update Tablename set[column name]=value;
example : Update employee_details set[salary]=20000;

Get the recent row entered in SQL

Posted by: onetidbit on: November 20, 2008

We can select the recent row enrtered by using the query below.
suppose the table name is employee;
then.

select * from employee where rowid=(select max(rowid) from employee).

This works fine because rowid is assigned for each and every record and in accending order. So the recent record’s rowid is the man (rowid). Please send feedback with any concern
or
You [...]

Retrieving port number with sql query

Posted by: onetidbit on: March 31, 2008

Declare @PortNumber VarChar(7)
Exec Xp_RegRead
@RootKey=’HKEY_LOCAL_MACHINE’,
@Key=’Software\Microsoft\Microsoft Sql Server\SQLEXPRESS\MSSQLServer\SuperSocketNetLib\Tcp’,
@Value_Name=’TcpPort’,
@Value=@PortNumber OutPut
Print ‘Port Number:’
Print @PortNumber

When you execute this you will get a problem to enable XP_CMDshell.You can enable by this.Read the article at:
Enabling xp_cmdshell in SQL Server 2005