Updating column values at once in sqlserver

Leave a comment


Here the query looks like:

Update Tablename set[column name]=value;

example : Update employee_details set[salary]=20000;

Advertisements

Get the recent row entered in SQL

Leave a comment


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 can check it with the help ofSCOPE_IDENTITY( ) function in SQL server 2000 or 2005.

Retrieving port number with sql query

Leave a comment



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

%d bloggers like this: