• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Jesse Silverman
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Al Hobbs
  • salvin francis

Transact-SQL CREATE TABLE

 
Ranch Hand
Posts: 2187
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
With a stored procedure, I want to create a table when a user registers with the application. I want to use an argument passed in the stored procedure call as part of the table name.

Example:

createUserTable '1987';

So, the CREATE statement would look like:

CREATE TABLE [dbo].[@arg_expense_record]

...

This should create a new table named: 1987_expense_record

I haven't figure out if this is possible. I keep creating a table with the @arg string in the table name instead of the value. I'm not sure if this can be done with the CREATE TABLE command in Transact-SQL.

Any help is greatly appreciated.

Thanks.
 
reply
    Bookmark Topic Watch Topic
  • New Topic