Results 1 to 2 of 2
  1. #1
    Join Date
    Feb 2004

    Unanswered: Append a Date to the end of a table name

    Is there a way to do so on the fly in SQL Server 2000? In other words, a field has the latest update date for the table and we wish to use this date as part of the table name. If so, please provide an example.


  2. #2
    Join Date
    Feb 2004
    In front of the computer
    Provided Answers: 54
    Do you really want to do this? It sounds like a receipe for disaster to me. The general idea would go something like:
    DECLARE @fubar VARCHAR(500)
    SELECT @fubar = 'SELECT * INTO [foo' + Convert(CHAR(10), GetDate(), 121)
    +  '] FROM foo'
    EXECUTE (@fubar)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts