Important Notice from AspDotNetStorefront
It is with dismay that we report that we have been forced, through the action of hackers, to shut off write-access to this forum. We are keen to leave the wealth of material available to you for research. We have opened a new forum from which our community of users can seek help, support and advice from us and from each other. To post a new question to our community, please visit: http://forums.vortx.com
Results 1 to 4 of 4

Thread: writing an insert statement to import customers

  1. #1
    sam.bengtson is offline Member
    Join Date
    Jan 2011
    Posts
    64

    Default writing an insert statement to import customers

    I know that I can use that WSI thing but I already know Sql so im trying to write a huge insert query(with the help of a little java) to add customers to our database. I'm having trouble getting the identity insert turned on in the customer table. Does anybody see anything wrong with this query I run, It is giving an error message of
    An explicit value for the identity column in table 'storefront.dbo.Customer' can only be specified when a column list is used and IDENTITY_INSERT is ON.
    Here is a test query that failed:
    SET IDENTITY_INSERT storefront.dbo.Customer ON
    insert into storefront.dbo.Customer values
    (58640,'',0,{fn now()},'test@test.com','test@test.com',null,NULL,N ULL,'Admin','User','',1,'',NULL,0,NULL,NULL,1,3,0, NULL,NULL,NULL,NULL,NULL,NULL,'en-US',0.00,1,NULL,1,2,NULL,1,1,NULL,1,1,1,NULL,NULL, 0,{fn now()},1,NULL,2,'',1,1,{fn now()},1,{fn now()},1,{fn now()},1,1,NULL,NULL)

  2. #2
    BFG 9000 is offline Senior Member
    Join Date
    Oct 2006
    Location
    South UK
    Posts
    882

    Default

    This may sound like a dumb question, but have you tried specifying a column list & setting IDENTITY_INSERT to 'ON'?


    TTFN

    BFG

  3. #3
    wunderkinder is offline Member
    Join Date
    Aug 2009
    Posts
    37

    Default

    Try adding GO after the first line.

    SET IDENTITY_INSERT storefront.dbo.Customer ON
    GO
    insert into storefront.dbo.Customer values

  4. #4
    sam.bengtson is offline Member
    Join Date
    Jan 2011
    Posts
    64

    Default

    got it. For whatever reason with the way the database is set up, you have to name the columns that your inserting into.
    ex. insert into (databasename).dbo.customer (email, password)
    values(email,password)