Thursday, May 21, 2009

How to insert records from te one table to another table in SQL

Hi Guys,

Last time i watch in the forums, one gentleman ask the question , how to insert records to one table from the another table in Sql Server.

This actually simple. and we can do this two ways.

1.normal way

insert into desttableName select * from databaseName.dbo.sourceTableName;

2.You can use the OpenRowSet also



FROM OPENROWSET(BULK 'SQLNCLI', 'Server=(local);Trusted_Connection=yes;', 'SELECT Columns FROM Database.Schema.Tablename ORDER BY columns)

Thank you
Keep It Watch

Monday, May 4, 2009

how to get how many records entered in day by a user in sql server.

Hi Guys,

Last time i look at the one fourm there one one question how do know how many records entered in per day by a user.

i thought in my mind make a script to that.


SELECT COUNT(*) From Tablebname
where CreatedDate=GetDate() and UserName=@UserName;

Note:You need keep a column for DateOfCreation in you table.

Thank you
Keep It Watch.

How to select random records in SQl Server.

Hi Guys,

Most of the developers, asking in forums how to select random records from the database in Sql Server.

Here script:

SELECT TOP 5 employeeID, FName,LName from Employee

Thank you
Keep It Watch

Friday, April 24, 2009


Hi Guys

Welcome to my Sql Server and MySql Resource blog.Please keep watch i will update soon useful material here.

Thank you
Keep It Watch