473,395 Members | 1,488 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

create table

Hi All,
I want to create tables csdplandata_1_x in a database, where 'x' is a value of column in other table in the same database.

Table1:
col-x
1
2
3

I need to create tables csdplandata_1_1,csdplandata_1_2,csdplandata_1_3 in one shot. Can anybody help me in writing T-SQL for this.
Feb 8 '07 #1
5 1841
iburyak
1,017 Expert 512MB
You can generate a script but you need to know what columns new tables will have.
Script can look something like this

[PHP]
Select ‘Create table csdplandata_1_’ + convert(varchar(10), col-x) + ‘(column1 datatype, column1 datatype)’
From Table1[/PHP]
Feb 8 '07 #2
Hi ,
I need a T-SQL statement. I wud be glad if u can give a T-SQL code
Feb 9 '07 #3
iburyak
1,017 Expert 512MB
This is a T-SQL statement to generate a script.
I don't know which columns will be in your new tables so there is no way for me to make it work for you.
When you generate this script you should get following:


Create table csdplandata_1_1(column1 datatype, column1 datatype)
Create table csdplandata_1_2(column1 datatype, column1 datatype)
Create table csdplandata_1_3(column1 datatype, column1 datatype)

Just execute these generated statements.
Feb 9 '07 #4
reon
80
you can add 'go' in between the tables created..



This is a T-SQL statement to generate a script.
I don't know which columns will be in your new tables so there is no way for me to make it work for you.
When you generate this script you should get following:


Create table csdplandata_1_1(column1 datatype, column1 datatype)
Create table csdplandata_1_2(column1 datatype, column1 datatype)
Create table csdplandata_1_3(column1 datatype, column1 datatype)

Just execute these generated statements.
Feb 13 '07 #5
I manage dto generate the table using a cursor..thanks for the help
Feb 13 '07 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Phil Powell | last post by:
create table if not exists nnet_produkt_varegruppe ( nnet_produkt_varegruppe_id int not null auto_increment, primary key(nnet_produkt_varegruppe_id), nnet_produkt_varegruppe_navn varchar(255) not...
6
by: dev | last post by:
how create a temp table as a copy of a existing table and then update1 field and insert the hole temp table back in the existing table? please any help? if i have 10 fields in 1 record and...
4
by: Michael Jackson | last post by:
I have a stored procedure to create a table. In my program I want the user to name the table to be created, therefore I pass a parameter to the SP for the table name. I cannot get it to work. It...
7
by: Wolfgang Kreuzer | last post by:
Hello all, I have two tables - Projects and ProjectStruct Table Projects contains master records of the projects, ProjectStruct allows to define a project herarchie and contains the fields...
1
by: poohnie08 | last post by:
i have a excel spreadsheet showing staff name, date,work hour, ot hour, slot1, slot2, slot3, slot4 and others). The "()" will keep repeating from day 1 until end of month. eg in excel spreadsheet,...
24
by: flkeyman | last post by:
Work in legal office. Trying to create solid designed database structure. This is list of tables w/fields and primary keys. Any comments/advice greatly appreciated. tbl-Defendants CaseNumber...
6
by: Peter Nurse | last post by:
For reasons that are not relevant (though I explain them below *), I want, for all my users whatever privelige level, an SP which creates and inserts into a temporary table and then another SP...
27
by: max | last post by:
Hello, I am a newbye, and I'm trying to write a simple application. I have five tables with three columns; all tables are identical; I need to change some data in the first table and let VB...
4
by: etuncer | last post by:
Hello All, I have Access 2003, and am trying to build a database for my small company. I want to be able to create a word document based on the data entered through a form. the real question is...
2
by: lakuma | last post by:
Hi, I have a table called A (say) with columns called name, place, animal and thing. I would want to write an on insert trigger on this table, which would create a table with the name of the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.