Append SQL table name with today’s date with SQL Query

I recently came across the following usefull SQL query, Maybe you’ll find it useful.
Create table with today’s date using SQL Query.


DECLARE @table varchar(500)
DECLARE @Q varchar(2000 )
SET @Q= 'CREATE TABLE '+  @table + ' (Id int, Name [nvarchar](50) NULL)'


7 responses to “Append SQL table name with today’s date with SQL Query”

  1. HI, do u have any idea on Paypal integration with .net

    i need to used Dodirectpayment method of paypal . pls let me know if u have any idea.

  2. I am trying to schedule a query that will run against a new table that is created every day. The table is named “tableName20120725”. How can i write a query that can account for the table name changing?

Leave a Reply to Pritesh