Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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
share|improve this question

2 Answers 2

up vote 0 down vote accepted

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

Should read:

'3B85ECD0-6CC0-4A68-BFB1-922ADC74F5B0',
share|improve this answer
    
YOU ARE AWESOME –  wcpro Jan 11 '10 at 20:33

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;

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.