PDA

View Full Version : Create Table with dynamic name


dorjan_bee
03-18-02, 06:26
Hi everyone,
I try to create tables with dynamic names, that means that i add the creation date to the table name ( e.g. myTable20020301 ) in Sybase 11
Is there any possibility to use a parameter as tablename ?

MattR
03-18-02, 20:06
ASE 11 didn't support dynamic SQL via the 'EXEC(..)' function. Are you using stored procedures I assume? What I'd do is send the raw SQL from an application, but perhaps this won't work in your case. Maybe also try using xp_cmdshell and running a script to create the table that way (e.g. myscript '20020301').

MattR
03-22-02, 14:16
http://www.sypron.nl/dynsql.html

Create the table with some name which you won't be using, then rename it with sp_rename.