Results 1 to 2 of 2
  1. #1
    Join Date
    Feb 2012
    Posts
    133

    Unanswered: need help in constructing script

    hi guys,
    i need some suggestions/ideas in constructing a script for insert statement with below sample.

    col1
    101201
    101202
    101203
    101204
    101205

    col2
    al
    al
    al
    al
    al

    col3
    pl
    pl
    pl
    pl
    pl

    i need to create an insert script where first four numbers(1012) in col1 is constant and the last two numbers are incrementing. your suggestions might help. thanks

  2. #2
    Join Date
    May 2005
    Location
    South Africa
    Posts
    1,365
    Provided Answers: 1
    So your table will have max 100 rows for sequence number 00-99?
    What is the significance of the first 4 digits? Split the first 4 and the sequence number into 2 columns
    Maybe you want to to this:
    Code:
    INSERT INTO the_table
    SELECT 1012, number, 'al', 'pl' 
    FROM master..spt_values 
    WHERE type='P' 
      AND number BETWEEN 1 AND 5

Posting Permissions

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