Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
knockyo
Yak Posting Veteran
83 Posts |
Posted - 2007-12-14 : 05:09:21
|
| Actually i have the idea for the script, but it cannot execute. Here it is:SELECT HOURLY_OUTPUT.* INTO HOURLY_OUTPUT IN DB_ARCHIVE.dbo FROM HOURLY_OUTPUTthe error is:Incorrect syntax near the keyword 'IN'.What it caused? |
|
|
harsh_athalye
Master Smack Fu Yak Hacker
5581 Posts |
Posted - 2007-12-14 : 05:11:41
|
quote: Originally posted by knockyo Actually i have the idea for the script, but it cannot execute. Here it is:SELECT HOURLY_OUTPUT.* INTO DB_ARCHIVE.dbo.HOURLY_OUTPUT IN DB_ARCHIVE.dbo FROM HOURLY_OUTPUTthe error is:Incorrect syntax near the keyword 'IN'.What it caused?
Harsh AthalyeIndia."The IMPOSSIBLE is often UNTRIED" |
 |
|
|
knockyo
Yak Posting Veteran
83 Posts |
Posted - 2007-12-14 : 05:21:41
|
quote: Originally posted by harsh_athalye
quote: Originally posted by knockyo Actually i have the idea for the script, but it cannot execute. Here it is:SELECT HOURLY_OUTPUT.* INTO DB_ARCHIVE.dbo.HOURLY_OUTPUT IN DB_ARCHIVE.dbo FROM HOURLY_OUTPUTthe error is:Incorrect syntax near the keyword 'IN'.What it caused?
Harsh AthalyeIndia."The IMPOSSIBLE is often UNTRIED"
Thanks for fast reply.if i want copy all the files older than 60days, how can it be done?SELECT HOURLY_OUTPUT.*INTO DB_ARCHIVE.dbo.HOURLY_OUTPUTFROM HOURLY_OUTPUTWHERE DT xxxxxxxxxx |
 |
|
|
RickD
Slow But Sure Yak Herding Master
3608 Posts |
Posted - 2007-12-14 : 05:32:36
|
| <= dateadd(dd,-60,datediff(dd,0,getdate())) |
 |
|
|
harsh_athalye
Master Smack Fu Yak Hacker
5581 Posts |
Posted - 2007-12-14 : 05:33:04
|
| [code]SELECT HOURLY_OUTPUT.*INTO DB_ARCHIVE.dbo.HOURLY_OUTPUTFROM HOURLY_OUTPUTWHERE dateadd(day, 0, datediff(day, 0, DT))< dateadd(day, 0, datediff(day, 0, dateadd(day, -60, getdate())))[/code]Harsh AthalyeIndia."The IMPOSSIBLE is often UNTRIED" |
 |
|
|
knockyo
Yak Posting Veteran
83 Posts |
Posted - 2007-12-14 : 05:45:14
|
quote: Originally posted by harsh_athalye
SELECT HOURLY_OUTPUT.*INTO DB_ARCHIVE.dbo.HOURLY_OUTPUTFROM HOURLY_OUTPUTWHERE dateadd(day, 0, datediff(day, 0, DT))< dateadd(day, 0, datediff(day, 0, dateadd(day, -60, getdate()))) Harsh AthalyeIndia."The IMPOSSIBLE is often UNTRIED"
if the database table already exists at the DB_ARCHIVE, how to ensure that i will update into the table? |
 |
|
|
knockyo
Yak Posting Veteran
83 Posts |
Posted - 2007-12-14 : 10:20:38
|
| How to copy from one table to another database? (Whether it exists or not i also need to insert records inside)??hope can guide me! |
 |
|
|
rmiao
Master Smack Fu Yak Hacker
7266 Posts |
Posted - 2007-12-14 : 23:15:00
|
| Use data import/export wizard. |
 |
|
|
|
|
|
|
|