Home > Archive > MS SQL Server > January 2006 > dynamical tablenames









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author dynamical tablenames
Ilya Dyoshin

2006-01-31, 3:23 am

Hi all!

I am about to create a procedure which will create tables with
dynamically specified tablenames.

Something like this

DECLARE tname CHAR(30);
SET tname = "1233321"; #or any string function
CREATE TABLE tname
(
#columns cpecification
);


But it doesn't works....
John Bell

2006-01-31, 3:23 am

Hi Ilya

You are not allowed to do this! If you can use temporary tables instead then
that would be a better solution. Failing that, read the following article
carefully http://www.sommarskog.se/dynamic_sql.html

John


"Ilya Dyoshin" wrote:

> Hi all!
>
> I am about to create a procedure which will create tables with
> dynamically specified tablenames.
>
> Something like this
>
> DECLARE tname CHAR(30);
> SET tname = "1233321"; #or any string function
> CREATE TABLE tname
> (
> #columns cpecification
> );
>
>
> But it doesn't works....
>

Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2008 droptable.com