SQL Server Performance

SQL script

Discussion in 'SQL Server DTS-Related Questions' started by gaurangpadhye, Jul 25, 2006.

  1. gaurangpadhye New Member

    I have 19 blank tables in a DB...I have to write a SQL Script for filling these tables with certain values for each column which i have.
    Can Someone pl help me out with any suggestions..
  2. waqar Member

    Just a few questions,

    1-
    You said you have values, do you mean is it txt file where you have these values or you are going to generate values on fly or going to copy from one table to another?

    2-
    Defination of each table is similar or different?

    3-
    Do you have different values to enter in different table or you have same set of values you wanted to enter in different tables?

    Give us some example/explanation here to assist you better.

    Waqar.


    ________________________________________________
    ~* Opinions are like a$$holes, everyone got one. *~
  3. gaurangpadhye New Member

    Hi Waqar,
    1. I have different values to enter into different blank tables in the DB
    2. I have to enter ceratin values like say company name, contractor name in a blank table which already has blank columns like company name and contractor name.
    3. Defination of each table is different
    Hope U can help..Any help is appreciated
  4. waqar Member

    Hi gaurang,<br /><br />Sure you will be helped <img src='/community/emoticons/emotion-1.gif' alt=':)' />.<br /><br />Would you mind to give me an example<br /><br />1- give me structure of table at least one of the table (if you don't want to show real table give me an example).<br /><br />2- tell me what is source of your data? Coz if you have text file to import then technique will be different and if you wanted to simulate test data value then procedure to import data will be different.<br /><br />Waqar.<br /><br />________________________________________________<br />~* Opinions are like a$$holes, everyone got one. *~
  5. gaurangpadhye New Member

    I have a list of values which i need to insert in few columns of the blank tables.
    One of the table is is as follows;

    companyname organisation indicator companyID




    Suppose i wanna insert SQLSERVER as companyname
    oragnisation= microsoft
    indicator=M
    Company ID = 44410
    Like this i have other list of values to be added to other blank tables
  6. waqar Member

    Not sure if this answer your question

    declare @tblname as varchar(10)
    declare @query as varchar(5000)

    set @tblname='tbl1'
    set @query='insert into ' + @tblname + ' select ''microsoft'',''M'',44410'
    exec (@query)


    Let me know.

    Waqar.

    ________________________________________________
    ~* Opinions are like a$$holes, everyone got one. *~

Share This Page