Friday, August 17, 2012

Get Records between two dates in MS SQL

Here query show how to select record between two dates in sql server.
select * from ContentMst
where c_date> = '2012-06-01' and c_date <= '2012-07-01'
order by c_date desc

How to insert record from one database to other database server

Here example show i am retrieving record from one server(DBServer2) and inserting in other server(DBServer1).
insert into Category(DBServer1)
select * from [DBServer2].[DatabaeName].[dbo].Category
Note: Both database server should be linq server otherwise it will give error.