July 9, 2009 at 12:11 am
I have a query related to database, I have explained it in detail below:
I have one table companymaster which contains companycode (primary key) and companyname as their field. There are three entry as per below. 1,abc-2,xyz-3,qpr. another table which contains productcode(primary key), company code(reference of companycode) and product name. in which there are some entries like 1,1,mnp-2,1,jnp and 3,1,rst.
I want a query which can create a new table having name as abc and files as mnp,jnp,rst at run time. Please help.
July 10, 2009 at 9:19 am
You may try to use IMPORT/EXPORT from a database.
July 10, 2009 at 9:46 am
You haven't really explained it in detail.
If you have data to export, you can use the BCP command to pull it out into files. However that will be in limited formats. SSIS can handle more formats, but gets more complicated.
If you are trying to create a new table with T-SQL, I'm not sure why you are referencing files.
When you describe the situation, use exact terms. I have a table called MyTable with 3 columns.
Create table mytable (
ColA int,
ColB int,
ColC varchar(20)
)
I have 3 rows of data. I need to create a new table that has a different name, same data, different data, and give examples.
July 13, 2009 at 9:43 am
Let me try to explain on other way
I have created one table
Table Name (Company Master which contains one
column as companycode (primary key) and
one column as companyname) mentioned data of table below:
COMPANYCODECOMPANYNAME
1 ABC
2 XYZ
3 PQR
Look at another table (Product master which contains one
column as productnumber
CompanycodeProductcodeProductname
1 1 lmn
1 2 mnp
1 3 Jtr
2 1 def
3 1 jhn
I have to have table named ABC,XYZ and PQR which should derived from table companymaster and having their fields as mentioned below:
Table named ABC should contain the field as lmn,mnp and jtr
while table XYZ should contain filelds as def
and table PQR should containd one filed as jhn.
I hope this one clears your idea....
thanks in advance,
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply