Wednesday, March 7, 2012

Going from osql to sqlcmd (MSDE to SqlExpress?)

I am familiar with loading a DB so that it will work under MSDE. This
is the command I use:
osql -S ServerName\InstanceName -E -i ScriptName.sql
So now I uninstalled MSDE and am using SqlExpress instead. To do the
same I tried:
Sqlcmd -S .\SQLExpress -i ScriptName.sql
and
Sqlcmd -S ServerName\SQLExpress -E -i ScriptName.sql
Which does not do anything except give me an erro stating that my DB
does not exist under SQLExpress. (Which is why I was trying to
install it )
Am I missing something? Do I need MSDE running on my toolbar?
How do I load a DB into SQLExpress?
Regards
oracle wrote:
> I am familiar with loading a DB so that it will work under MSDE. This
> is the command I use:
> osql -S ServerName\InstanceName -E -i ScriptName.sql
> So now I uninstalled MSDE and am using SqlExpress instead. To do the
> same I tried:
> Sqlcmd -S .\SQLExpress -i ScriptName.sql
> and
> Sqlcmd -S ServerName\SQLExpress -E -i ScriptName.sql
>
Those commands do not load a database. They connect to the specified SQL
Server instance. The SQL service is already running and the databases
are mounted and ready. It sounds like the problem you are having is that
SQL Express does not know about your MSDE databases. How did you move
the databases to SQL Express? If you didn't move them, you might be able
to use the "CREATE DATABASE database_name FOR ATTACH" command. If you
still have MSDE installed, first detach the databases using sp_detach_db
and copy them over the SQL Express data folder. I do not know if you can
do this from SQL Express Manager.
David Gugick
Quest Software
www.quest.com

No comments:

Post a Comment