[dba-SQLServer] SQL Server 2005 - Copying a database

Arthur Fuller fuller.artful at gmail.com
Thu Sep 10 08:35:52 CDT 2009


To shrink the transaction log from within SSMS, you open a query window and
issue:
dbcc shrinkfile <logfileName> TRUNCATE ONLY.

I've never tried to execute that command from within a stored procedure but
I think that it could work.

As to the earlier question, I tried what I suggested and it didn't work. I'm
still looking into it. I'll get back to you on that in a bit.

Arthur

On Thu, Sep 10, 2009 at 8:53 AM, jwcolby <jwcolby at colbyconsulting.com>wrote:

> Interesting Arthur.
>
> So from the gui I right click on the db of interest, /tasks / copy
> database.  A wizard opens and I
> do my thing, naming the files, where they should go etc.
>
> Are you saying that SQL Server saves that somewhere as TSQL and I can go
> look at it?
>
> John W. Colby
> www.ColbyConsulting.com
>
>
> Arthur Fuller wrote:
> > I've never had to do this, but I think that this approach would work. The
> > whole Management Studio UI (and Enterprise Manager before it) are nothing
> > but front ends that hide T-SQL commands. Whenever I want to know what
> SSMS
> > is doing under the covers, I execute the command of interest using the
> GUI
> > and then view the query syntax (include query with results).
> > Arthur
> >
> > On Thu, Sep 10, 2009 at 8:24 AM, jwcolby <jwcolby at colbyconsulting.com
> >wrote:
> >
> >> I need to programmatically copy a database to a new name (make a copy),
> and
> >> specify where the data
> >> file and log file goes.  Can anyone give me help in figuring that out?
>  I
> >> want to write a stored
> >> procedure to do this and call that from Access.
> >>
> >>
> > _______________________________________________
> > dba-SQLServer mailing list
> > dba-SQLServer at databaseadvisors.com
> > http://databaseadvisors.com/mailman/listinfo/dba-sqlserver
> > http://www.databaseadvisors.com
> >
> >
> _______________________________________________
> dba-SQLServer mailing list
> dba-SQLServer at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/dba-sqlserver
> http://www.databaseadvisors.com
>
>



More information about the dba-SQLServer mailing list