Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8063387
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T11:00:51+00:00 2026-06-05T11:00:51+00:00

I have a customer database I would like to add a set of Card

  • 0

I have a customer database I would like to add a set of Card numbers to. In the table there are multiple columns that will be the same, however the Card number will increase by 1 until finished. So for example… I want to add Gift cards 1 – 250 with the other columns the same… so it would like something like this:

Cardnum      price    booktype   service 
1             9.99       1         12 
2             9.99       1         12
3             9.99       1         12

etc etc… This would repeat until cardnum was ‘250’ Is it possible to do this with an SQL Query?

Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T11:00:53+00:00Added an answer on June 5, 2026 at 11:00 am

    @jimdrang already provided the answer, but since I was just finishing a full example with the CREATE TABLE and a stored procedure to do the job, I guess I might as well post it for the benefit of anyone looking for this down the road.

    CREATE TABLE Cards
    (
      Cardnum int not null primary key,
      price money not null,
      booktype int not null,
      service int not null
    );
    GO
    
    CREATE PROCEDURE [dbo].[sp_AddCards] (
      @Price money,
      @BookType int,
      @Service int,
      @NumCards int,
      @StartNum int
    )
      AS
    BEGIN
      DECLARE @CurCard int
      SELECT @CurCard = @StartNum
    
      WHILE @CurCard < @StartNum + @NumCards
      BEGIN
        INSERT INTO Cards (Cardnum, price, booktype, service)
        VALUES (@CurCard, @Price, @BookType, @Service)
    
        SELECT @CurCard = @CurCard + 1
      END
    END
    
    GO
    
    EXEC sp_AddCards @Price=9.99, @BookType=1, @Service=12, @NumCards=250, @Startnum=810041;
    
    SELECT * FROM Cards;
    
    DROP TABLE Cards;
    DROP PROCEDURE sp_AddCards;
    

    Hope it helps!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two tables in my database that look like that: Customer: C_ID city
I have an customer invoice table in my MySQL database with a DECIMAL(10,2) field
I have a customer that has an application that uses an Advantage Database. I
I have such tables in my database like Customer , Member , Instructor ,
I have a simple database named customer with a single table data.I want to
Suppose I have a class Customer that is mapped to the database and everything
I have a web database app that runs in IE7+ (customer requirement) It is
Following is the problem statement: I have a database table with entries that look
I have writted a Java program that will be able to add customers to
I have a domain model that includes something like this: public class Customer :

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.