Re: Another Scripting ?
From: Ricardo (rgutery_at_mentorits.com)
Date: 05/21/04
- Next message: Ricardo: "Re: SQL Variable USE."
- Previous message: Ricardo: "Re: SQL Variable USE."
- In reply to: Tibor Karaszi: "Re: Another Scripting ?"
- Messages sorted by: [ date ] [ thread ]
Date: Fri, 21 May 2004 17:19:17 -0600
Thanks Tibor. The code actually does work. But the table name is the
variable name (i.e. @Filename), so I suspected that I would have to use
Dynamic SQL.
Tx...
"Tibor Karaszi" <tibor_please.no.email_karaszi@hotmail.nomail.com> wrote in
message news:un7cUg4PEHA.2468@TK2MSFTNGP11.phx.gbl...
> It is a bit too late for me to check, but assume that your code it
logically correct, CREATE DATABASE doesn't
> accept a parameter for filename (TSQL is a bit restrictive regarding
accepting variable for parameters; Books
> Online wasn't clear on the subject either). Assuming that this is the
case, you have to go for dynamic SQL.
>
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://www.solidqualitylearning.com/
>
>
> "Ricardo" <rgutery@mentorits.com> wrote in message
news:uC3vWX4PEHA.2704@TK2MSFTNGP10.phx.gbl...
> > Given the following code snippet from a stored proc:
> > USE master
> > GO
> > CREATE DATABASE Sales
> > ON
> > ( NAME = Sales_dat,
> > FILENAME = 'c:\test\testdata.mdf,
> > SIZE = 10,
> > MAXSIZE = 50,
> > FILEGROWTH = 5 )
> > LOG ON
> > ( NAME = 'Sales_log',
> > FILENAME = 'c:\test\testlog.ldf',
> > SIZE = 5MB,
> > MAXSIZE = 25MB,
> > FILEGROWTH = 5MB )
> > GO
> >
> > I pass the name of FILENAME as a paramater then want to use the contents
of
> > the passed parm in the file name like so:
> >
> > CREATE PROC...
> >
> > ( NAME = Sales_dat,
> > FILENAME = @Filename
> >
> > It chokes, and all is not working.
> >
> > Any ideas would be appreciated.
> >
> >
>
>
- Next message: Ricardo: "Re: SQL Variable USE."
- Previous message: Ricardo: "Re: SQL Variable USE."
- In reply to: Tibor Karaszi: "Re: Another Scripting ?"
- Messages sorted by: [ date ] [ thread ]