Wrox Programmer Forums
Go Back   Wrox Programmer Forums > SQL Server > SQL Server 2000 > SQL Server 2000
|
SQL Server 2000 General discussion of Microsoft SQL Server -- for topics that don't fit in one of the more specific SQL Server forums. version 2000 only. There's a new forum for SQL Server 2005.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Server 2000 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 14th, 2005, 07:15 PM
Registered User
 
Join Date: Dec 2004
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default Create table <dynamic_name>

I'm busy with a schoolproject and this is what I want to do:

I want to call for a stored procedure, say: MakeTable(year as int)
This procedure has to create some tables which have the year in it.
For Example 'Order_2005'
And off course I want it to do in 2006 as 'Order_2006'

How can this be done ????

 
Old February 14th, 2005, 08:27 PM
Friend of Wrox
 
Join Date: May 2004
Posts: 642
Thanks: 0
Thanked 43 Times in 42 Posts
Default

You can use dynamic queries to execute..,

declare @test varchar(440)
SET @test = 'create table Test_table_t (a1 int)'
EXEC(@TEST)

@test is a string which can be used to append 'Order' + '2005' run the SQL

Om Prakash





Similar Threads
Thread Thread Starter Forum Replies Last Post
<table> not displaying because of <iframe> crmpicco HTML Code Clinic 16 October 6th, 2007 04:46 PM
create <ul> with alternating class on <li> element Brian Campbell XSLT 2 November 3rd, 2006 06:07 PM
can't create table when <% ...%> is in page hertendreef ASP.NET 2.0 Basics 3 May 29th, 2006 10:32 PM
Regular Expression to remove <table> </table> tags mathalete CSS Cascading Style Sheets 2 January 23rd, 2006 01:59 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.