1

I have the following query... ive checked and rechecked the types and number of values in both the insert into and the select statements. I can't figure out what is wrong.

insert into [Subscription].dbo.SUBSCRIPTION (
    CreateDate, 
    StartDate, 
    ProductId, 
    Processor, 
    IntervalType, 
    IntervalLength, 
    TotalOccurrences, 
    TrialOccurrences, 
    Status, 
    Amount, --10 
    TrialAmount, 
    FirstName, 
    LastName, 
    Address, 
    City, 
    State, 
    Zip, 
    Country, 
    Phone, 
    Email, --20
    CardNumber, 
    CardExpMonth, 
    CardExpYear, 
    Custom1, 
    Custom2, 
    Custom3, 
    SecurityCode, 
    CancellationDate, 
    ApplicationName, 
    OfferTypeID, --30
    OfferID, 
    CampaignID, 
    SubID, 
    OrderID) --34 items
select
    o.CreateDate, 
    DATEADD(day, 4, o.createdate) as startdate, 
    '3B85ECD0-6CC0-4A68-BFB1-922ADC74F5B0'
    'cb_test', 
    1, 
    1, 
    99, 
    0, 
    0, 
    59.84, --10
    0.00, 
    o.First_Name, 
    o.Last_Name, 
    o.Address_1, 
    o.City, 
    o.State, 
    o.Zip_Code, 
    o.Country, 
    o.Phone1, 
    o.Email, --20
    o.CC_Number, 
    o.CC_Exp_Month, 
    o.CC_Exp_Year, 
    'imported 1/11/2010', 
    null, 
    null, 
    '', 
    null, 
    'company', 
    null, --30
    o.ofid, 
    o.cid, 
    o.sid, 
    o.oid --34 items
from [pro].dbo.slp_Order o where o.oid> 7782221 and o.Isbilled = 1

2 Answers 2

0

You missed the comma after the ProductID value in the SELECT portion of the statement.

Should read:

'3B85ECD0-6CC0-4A68-BFB1-922ADC74F5B0',
1
  • YOU ARE AWESOME Jan 11, 2010 at 20:33
0

Does the subscription table have an auto-incrementing key? Some databases require that you provide a value for the id even if it is overwritten by the database. i.e

insert into tabl2 (id,name,address) select 0,myname,myaddress from tableb;

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .