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
INSERT INTO YourTableName
SELECT *
FROM OPENROWSET(BULK 'SQLNCLI', 'Server=(local);Trusted_Connection=yes;', 'SELECT Columns FROM Database.Schema.Tablename ORDER BY columns)
Thank you
Keep It Watch
Thursday, May 21, 2009
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.
Script:
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.
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.
Script:
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
ORDER BY NEWID();
Thank you
Keep It Watch
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
ORDER BY NEWID();
Thank you
Keep It Watch
Subscribe to:
Posts (Atom)