|
server
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
SQL script
Any ideas on scripting an SQL database to overwrite another SQL database (in
SQL2005Express??) I've got: RESTORE DATABASE <name> FROM DISK = ‘C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Backup\<name>.bak Is there something I'm missing? -- denverdude in OZ "denverdude" wrote: Wrong group probably, you should post in a SQL Server group. From command > Any ideas on scripting an SQL database to overwrite another SQL database (in > SQL2005Express??) > > I've got: > RESTORE DATABASE <name> > FROM DISK = > ‘C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Backup\<name>.bak > > Is there something I'm missing? > line you could use sqlcmd: sqlcmd -S "ServerName" -E -Q "RESTORE DATABASE myDatabase FROM DISK = 'c:\microsoft sql server\MSSQL.1\MSSQL\Backup\myDatabase.bak'" -S - Server name -E - Use trusted connection -Q - Query string -- urkec Can you not detach the previous database, and then it should not be
recognized unless you re attach? Show quote "denverdude" wrote: > Any ideas on scripting an SQL database to overwrite another SQL database (in > SQL2005Express??) > > I've got: > RESTORE DATABASE <name> > FROM DISK = > ‘C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Backup\<name>.bak > > Is there something I'm missing? > > -- > denverdude in OZ Try right click the database that you want to
restore-->Tasks-->Restore-->Database-->Restore-->Build-->Specify Backup-->Show Location-->Options for Restore options-->Overwrite Existing Database. This is rough, of course, and not code or anything. I have just been messing with SQL for weeks, and it is starting to grow on me (like an alien fungus LOL). I feel like an idiot savant. I understand some, but I can't open a view to extract information because I have the code wrong all the time. This should be so simple! I say, CREATE VIEW.........and no matter what I type in, it says that is invalid, or improper syntax. Its making me crazy! Good luck!! Show quote "denverdude" wrote: > Any ideas on scripting an SQL database to overwrite another SQL database (in > SQL2005Express??) > > I've got: > RESTORE DATABASE <name> > FROM DISK = > ‘C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Backup\<name>.bak > > Is there something I'm missing? > > -- > denverdude in OZ |
|||||||||||||||||||||||