| Author |
Topic |
|
Nathan_
Starting Member
5 Posts |
Posted - 2009-12-04 : 21:29:17
|
Sorry for the newbie question, but I feel Im almost there to figuring out the issue.I run NopCommerce on SQL 2005. The site works great, but I need to change the invoice number from starting at 1 to now start at 5000. (Invoice numbers are given to all orders in a consecutive number)I asked the question over on the NopCommerce site, but didn't get to far. I did how ever get one bit of information from one of the programmers.Execute the following script over your database:SET IDENTITY_INSERT [dbo].[Nop_Order] ONINSERT [dbo].[Nop_Order] ([OrderID], [OrderGUID],...other columns) VALUES (5000, N'08058c7e-7fc2-479a-a004-85bd3a8072d2', ...orther values)DELETE FROM [dbo].[Nop_Order]WHERE OrderID=5000SET IDENTITY_INSERT [dbo].[Nop_Order] OFF Well Obviously the "....other columns)" I need to fill in, so I tried..I took a CSV file and opened it to get the Columns and Values needed. SET IDENTITY_INSERT [dbo].[Nop_Order] ONINSERT [dbo].[Nop_Order] ([OrderID], [OrderGUID],OrderID,OrderGUID,CustomerID,CustomerLanguageID,OrderTax,OrderTotal,OrderDiscount,OrderTaxInCustomerCurrency,OrderTotalInCustomerCurrency,CustomerCurrencyCode,OrderWeight,AffiliateID,OrderStatusID,CardType,CardName,CardNumber,CardCVV2,CardExpirationMonth,CardExpirationYear,PaymentMethodID,PaymentMethodName,AuthorizationTransactionID,AuthorizationTransactionCode,AuthorizationTransactionResult,CaptureTransactionID,CaptureTransactionResult,PurchaseOrderNumber,PaymentStatusID,BillingFirstName,BillingLastName,BillingPhoneNumber,BillingEmail,BillingFaxNumber,BillingCompany,BillingAddress1,BillingAddress2,BillingCity,BillingStateProvince,BillingStateProvinceID,BillingZipPostalCode,BillingCountry,BillingCountryID,ShippingStatusID,ShippingFirstName,ShippingLastName,ShippingPhoneNumber,ShippingEmail,ShippingFaxNumber,ShippingCompany,ShippingAddress1,ShippingAddress2,ShippingCity,ShippingStateProvince,ShippingStateProvinceID,ShippingZipPostalCode,ShippingCountry,ShippingCountryID,ShippingMethod,ShippingRateComputationMethodID,ShippedDate,Deleted,CreatedOn,OrderSubtotalInclTax,OrderSubtotalExclTax,OrderSubtotalInclTaxInCustomerCurrency,OrderSubtotalExclTaxInCustomerCurrency,CustomerTaxDisplayTypeID,OrderShippingInclTax,OrderShippingExclTax,OrderShippingInclTaxInCustomerCurrency,OrderShippingExclTaxInCustomerCurrency,PaymentMethodAdditionalFeeInclTax,PaymentMethodAdditionalFeeExclTax,PaymentMethodAdditionalFeeInclTaxInCustomerCurrency,PaymentMethodAdditionalFeeExclTaxInCustomerCurrency) VALUES (5000, N'08058c7e-7fc2-479a-a004-85bd3a8072d2', 37,7,0.0000,142.5000,0.0000,0.0000,142.5000,USD,2.5,0,10,,,,,mr8Id8P3LXM=,mr8Id8P3LXM=,2,PayPal Standard,,,,,,,10,John,Smith,12345678,admin@yourStore.com,,Nop Solutions,21 West 52nd Street,,New York,New York,41,10021,United States,1,20,John,Smith,12345678,admin@yourStore.com,,Nop Solutions,21 West 52nd Street,,New York,New York,41,10021,United States,1,By Ground,8,,true,9/6/2009 6:31:42 PM,125.0000,125.0000,125.0000,125.0000,1,17.5000,17.5000,17.5000,17.5000,0.0000,0.0000,0.0000,0.0000)DELETE FROM [dbo].[Nop_Order]WHERE OrderID=5000SET IDENTITY_INSERT [dbo].[Nop_Order] OFF I was getting ERRORS saying, "The name "USD" is not permitted in this context. Valid expressions are constants, constant expressions, and (in some contexts) variables. Column names are not permitted."Ok so digging around in this database I see where it has the currency and a (5) next to it. I assume its the default so I tried it. Now I get errors saying Syntax Error Next to "'". |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
|
rajdaksha
Aged Yak Warrior
595 Posts |
Posted - 2009-12-04 : 22:49:33
|
| HIDid you check your Insert Statement syntax. Insert statement should be like this..INSERT INTO TABLE_NAME VALUES(INT_VALUES,'CHAR_VALUES','DATETIME_VALUES',null)-------------------------R... |
 |
|
|
Nathan_
Starting Member
5 Posts |
Posted - 2009-12-04 : 23:21:49
|
| Thats for the quick reply guys. I did what you said and still had issues.. (I promise I'm learning from this experience ) :-DSET IDENTITY_INSERT [dbo].[Nop_Order] ONINSERT [dbo].[Nop_Order] ([OrderID], [OrderGUID],[OrderID],[OrderGUID],[CustomerID],[CustomerLanguageID],[OrderTax],[OrderTotal],[OrderDiscount],[OrderTaxInCustomerCurrency],[OrderTotalInCustomerCurrency],[CustomerCurrencyCode],[OrderWeight],[AffiliateID],[OrderStatusID],[CardType],[CardName],[CardNumber],[CardCVV2],[CardExpirationMonth],[CardExpirationYear],[PaymentMethodID],[PaymentMethodName],[AuthorizationTransactionID],[AuthorizationTransactionCode],[AuthorizationTransactionResult],[CaptureTransactionID],[CaptureTransactionResult],[PurchaseOrderNumber],[PaymentStatusID],[BillingFirstName],[BillingLastName],[BillingPhoneNumber],[BillingEmail],[BillingFaxNumber],[BillingCompany],[BillingAddress1],[BillingAddress2],[BillingCity],[BillingStateProvince],[BillingStateProvinceID],[BillingZipPostalCode],[BillingCountry],[BillingCountryID],[ShippingStatusID],[ShippingFirstName],[ShippingLastName],[ShippingPhoneNumber],[ShippingEmail],[ShippingFaxNumber],[ShippingCompany],[ShippingAddress1],[ShippingAddress2],[ShippingCity],[ShippingStateProvince],[ShippingStateProvinceID],[ShippingZipPostalCode],[ShippingCountry],[ShippingCountryID],[ShippingMethod],[ShippingRateComputationMethodID],[ShippedDate],[Deleted],[CreatedOn],[OrderSubtotalInclTax],[OrderSubtotalExclTax],[OrderSubtotalInclTaxInCustomerCurrency],[OrderSubtotalExclTaxInCustomerCurrency],[CustomerTaxDisplayTypeID],[OrderShippingInclTax],[OrderShippingExclTax],[OrderShippingInclTaxInCustomerCurrency],[OrderShippingExclTaxInCustomerCurrency],[PaymentMethodAdditionalFeeInclTax],[PaymentMethodAdditionalFeeExclTax],[PaymentMethodAdditionalFeeInclTaxInCustomerCurrency],[PaymentMethodAdditionalFeeExclTaxInCustomerCurrency])INSERT INTO TABLE_NAME VALUES VALUES (5000, N'08058c7e-7fc2-479a-a004-85bd3a8072d2',37,7,0.0000,142.5000,0.0000,0.0000,142.5000,'USD',2.5,0,10,,,,,'mr8Id8P3LXM=','mr8Id8P3LXM=',2,'PayPal Standard',,,,,,,10,'John,Smith,12345678','admin@yourStore.com',,'Nop Solutions','21 West 52nd Street',,'New York','New York',41,10021,'United States',1,20,'John,Smith',12345678,'admin@yourStore.com',,'Nop Solutions','21 West 52nd Street',,'New York','New York',41,10021,'United States',1,'By Ground',8,,'true','9/6/2009 6:31:42 PM',125.0000,125.0000,125.0000,125.0000,1,17.5000,17.5000,17.5000,17.5000,0.0000,0.0000,0.0000,0.0000)DELETE FROM [dbo].[Nop_Order]WHERE OrderID=5000SET IDENTITY_INSERT [dbo].[Nop_Order] OFFIncorrect syntax near the keyword 'INSERT'. Incorrect syntax near the keyword 'VALUES'. |
 |
|
|
rajdaksha
Aged Yak Warrior
595 Posts |
Posted - 2009-12-04 : 23:26:43
|
quote: Originally posted by Nathan_ Thats for the quick reply guys. I did what you said and still had issues.. (I promise I'm learning from this experience ) :-DSET IDENTITY_INSERT [dbo].[Nop_Order] ONINSERT [dbo].[Nop_Order] ([OrderID], [OrderGUID],[OrderID],[OrderGUID],[CustomerID],[CustomerLanguageID],[OrderTax],[OrderTotal],[OrderDiscount],[OrderTaxInCustomerCurrency],[OrderTotalInCustomerCurrency],[CustomerCurrencyCode],[OrderWeight],[AffiliateID],[OrderStatusID],[CardType],[CardName],[CardNumber],[CardCVV2],[CardExpirationMonth],[CardExpirationYear],[PaymentMethodID],[PaymentMethodName],[AuthorizationTransactionID],[AuthorizationTransactionCode],[AuthorizationTransactionResult],[CaptureTransactionID],[CaptureTransactionResult],[PurchaseOrderNumber],[PaymentStatusID],[BillingFirstName],[BillingLastName],[BillingPhoneNumber],[BillingEmail],[BillingFaxNumber],[BillingCompany],[BillingAddress1],[BillingAddress2],[BillingCity],[BillingStateProvince],[BillingStateProvinceID],[BillingZipPostalCode],[BillingCountry],[BillingCountryID],[ShippingStatusID],[ShippingFirstName],[ShippingLastName],[ShippingPhoneNumber],[ShippingEmail],[ShippingFaxNumber],[ShippingCompany],[ShippingAddress1],[ShippingAddress2],[ShippingCity],[ShippingStateProvince],[ShippingStateProvinceID],[ShippingZipPostalCode],[ShippingCountry],[ShippingCountryID],[ShippingMethod],[ShippingRateComputationMethodID],[ShippedDate],[Deleted],[CreatedOn],[OrderSubtotalInclTax],[OrderSubtotalExclTax],[OrderSubtotalInclTaxInCustomerCurrency],[OrderSubtotalExclTaxInCustomerCurrency],[CustomerTaxDisplayTypeID],[OrderShippingInclTax],[OrderShippingExclTax],[OrderShippingInclTaxInCustomerCurrency],[OrderShippingExclTaxInCustomerCurrency],[PaymentMethodAdditionalFeeInclTax],[PaymentMethodAdditionalFeeExclTax],[PaymentMethodAdditionalFeeInclTaxInCustomerCurrency],[PaymentMethodAdditionalFeeExclTaxInCustomerCurrency])INSERT INTO TABLE_NAME VALUES (5000, N'08058c7e-7fc2-479a-a004-85bd3a8072d2',37,7,0.0000,142.5000,0.0000,0.0000,142.5000,'USD',2.5,0,10,,,,,'mr8Id8P3LXM=','mr8Id8P3LXM=',2,'PayPal Standard',,,,,,,10,'John,Smith,12345678','admin@yourStore.com',,'Nop Solutions','21 West 52nd Street',,'New York','New York',41,10021,'United States',1,20,'John,Smith',12345678,'admin@yourStore.com',,'Nop Solutions','21 West 52nd Street',,'New York','New York',41,10021,'United States',1,'By Ground',8,,'true','9/6/2009 6:31:42 PM',125.0000,125.0000,125.0000,125.0000,1,17.5000,17.5000,17.5000,17.5000,0.0000,0.0000,0.0000,0.0000)DELETE FROM [dbo].[Nop_Order]WHERE OrderID=5000SET IDENTITY_INSERT [dbo].[Nop_Order] OFFIncorrect syntax near the keyword 'INSERT'. Incorrect syntax near the keyword 'VALUES'.
insert into table_name values(1,2,3..)-------------------------R... |
 |
|
|
Nathan_
Starting Member
5 Posts |
Posted - 2009-12-05 : 00:10:40
|
| :-(Incorrect syntax near the keyword 'INSERT'. Incorrect syntax near ','. |
 |
|
|
rajdaksha
Aged Yak Warrior
595 Posts |
Posted - 2009-12-05 : 01:24:21
|
should be like this...pls check the columns and passed values...SET IDENTITY_INSERT [dbo].[Nop_Order] ONINSERT [dbo].[Nop_Order] ( [OrderID] , [OrderGUID] , [OrderID] , [OrderGUID] , [CustomerID] , [CustomerLanguageID] , [OrderTax] , [OrderTotal] , [OrderDiscount] , [OrderTaxInCustomerCurrency] , [OrderTotalInCustomerCurrency] , [CustomerCurrencyCode] , [OrderWeight] , [AffiliateID] , [OrderStatusID] , [CardType] , [CardName] , [CardNumber] , [CardCVV2] , [CardExpirationMonth] , [CardExpirationYear] , [PaymentMethodID] , [PaymentMethodName] , [AuthorizationTransactionID] , [AuthorizationTransactionCode] , [AuthorizationTransactionResult] , [CaptureTransactionID] , [CaptureTransactionResult] , [PurchaseOrderNumber] , [PaymentStatusID] , [BillingFirstName] , [BillingLastName] , [BillingPhoneNumber] , [BillingEmail] , [BillingFaxNumber] , [BillingCompany] , [BillingAddress1] , [BillingAddress2] , [BillingCity] , [BillingStateProvince] , [BillingStateProvinceID] , [BillingZipPostalCode] , [BillingCountry] , [BillingCountryID] , [ShippingStatusID] , [ShippingFirstName] , [ShippingLastName] , [ShippingPhoneNumber] , [ShippingEmail] , [ShippingFaxNumber] , [ShippingCompany] , [ShippingAddress1] , [ShippingAddress2] , [ShippingCity] , [ShippingStateProvince] , [ShippingStateProvinceID] , [ShippingZipPostalCode] , [ShippingCountry] , [ShippingCountryID] , [ShippingMethod] , [ShippingRateComputationMethodID] , [ShippedDate] , [Deleted] , [CreatedOn] , [OrderSubtotalInclTax] , [OrderSubtotalExclTax] , [OrderSubtotalInclTaxInCustomerCurrency] , [OrderSubtotalExclTaxInCustomerCurrency] , [CustomerTaxDisplayTypeID] , [OrderShippingInclTax] , [OrderShippingExclTax] , [OrderShippingInclTaxInCustomerCurrency] , [OrderShippingExclTaxInCustomerCurrency] , [PaymentMethodAdditionalFeeInclTax] , [PaymentMethodAdditionalFeeExclTax] , [PaymentMethodAdditionalFeeInclTaxInCustomerCurrency], [PaymentMethodAdditionalFeeExclTaxInCustomerCurrency] ) VALUES ( 5000 , N'08058c7e-7fc2-479a-a004-85bd3a8072d2', 37,7, 0.0000 , 142.5000, 0.0000 , 0.0000 , 142.5000, 'USD' , 2.5 , 0,10, NULL , NULL , NULL , NULL , 'mr8Id8P3LXM=' , 'mr8Id8P3LXM=' , 2 , 'PayPal Standard' , NULL , NULL , NULL , NULL , NULL , NULL , 10 , 'John,Smith,12345678', 'admin@yourStore.com', NULL , 'Nop Solutions' , '21 West 52nd Street', null, 'New York', 'New York', 41,10021, 'United States', 1,20, 'John,Smith' , 12345678 , 'admin@yourStore.com', NULL , 'Nop Solutions' , '21 West 52nd Street', NULL , 'New York' , 'New York' , 41,10021, 'United States' , 1 , 'By Ground' , 8 , NULL , 'true' , '9/6/2009 6:31:42 PM', 125.0000 , 125.0000 , 125.0000 , 125.0000 , 1 , 17.5000 , 17.5000 , 17.5000 , 17.5000 , 0.0000 , 0.0000 , 0.0000 , 0.0000 ) DELETEFROM [dbo].[Nop_Order]WHERE OrderID=5000SET IDENTITY_INSERT [dbo].[Nop_Order] OFF -------------------------R... |
 |
|
|
Nathan_
Starting Member
5 Posts |
Posted - 2009-12-05 : 02:08:20
|
| [code]SET IDENTITY_INSERT [dbo].[Nop_Order] ONINSERT [dbo].[Nop_Order] ( [OrderID] , [OrderGUID] , [OrderID] , [OrderGUID] , [CustomerID] , [CustomerLanguageID] , [OrderTax] , [OrderTotal] , [OrderDiscount] , [OrderTaxInCustomerCurrency] , [OrderTotalInCustomerCurrency] , [CustomerCurrencyCode] , [OrderWeight] , [AffiliateID] , [OrderStatusID] , [CardType] , [CardName] , [CardNumber] , [CardCVV2] , [CardExpirationMonth] , [CardExpirationYear] , [PaymentMethodID] , [PaymentMethodName] , [AuthorizationTransactionID] , [AuthorizationTransactionCode] , [AuthorizationTransactionResult] , [CaptureTransactionID] , [CaptureTransactionResult] , [PurchaseOrderNumber] , [PaymentStatusID] , [BillingFirstName] , [BillingLastName] , [BillingPhoneNumber] , [BillingEmail] , [BillingFaxNumber] , [BillingCompany] , [BillingAddress1] , [BillingAddress2] , [BillingCity] , [BillingStateProvince] , [BillingStateProvinceID] , [BillingZipPostalCode] , [BillingCountry] , [BillingCountryID] , [ShippingStatusID] , [ShippingFirstName] , [ShippingLastName] , [ShippingPhoneNumber] , [ShippingEmail] , [ShippingFaxNumber] , [ShippingCompany] , [ShippingAddress1] , [ShippingAddress2] , [ShippingCity] , [ShippingStateProvince] , [ShippingStateProvinceID] , [ShippingZipPostalCode] , [ShippingCountry] , [ShippingCountryID] , [ShippingMethod] , [ShippingRateComputationMethodID] , [ShippedDate] , [Deleted] , [CreatedOn] , [OrderSubtotalInclTax] , [OrderSubtotalExclTax] , [OrderSubtotalInclTaxInCustomerCurrency] , [OrderSubtotalExclTaxInCustomerCurrency] , [CustomerTaxDisplayTypeID] , [OrderShippingInclTax] , [OrderShippingExclTax] , [OrderShippingInclTaxInCustomerCurrency] , [OrderShippingExclTaxInCustomerCurrency] , [PaymentMethodAdditionalFeeInclTax] , [PaymentMethodAdditionalFeeExclTax] , [PaymentMethodAdditionalFeeInclTaxInCustomerCurrency], [PaymentMethodAdditionalFeeExclTaxInCustomerCurrency] ) VALUES ( 5000 , N'08058c7e-7fc2-479a-a004-85bd3a8072d2', 37,7, 0.0000 , 142.5000, 0.0000 , 0.0000 , 142.5000, 5 , 2.5 , 0, 10, NULL , NULL , NULL , NULL , 'mr8Id8P3LXM=' , 'mr8Id8P3LXM=' , 2 , 'PayPal Standard' , NULL , NULL , NULL , NULL , NULL , NULL , 10 , 'John', 'Smith', 1234567, 'admin@yourStore.com', NULL , 'Nop Solutions' , '21 West 52nd Street', null, 'New York', 'New York', 41,10021, 'United States', 1,20, 'John', 'Smith' , 12345678 , 'admin@yourStore.com', NULL , 'Nop Solutions' , '21 West 52nd Street', NULL , 'New York' , 'New York' , 41,10021, 'United States' , 1 , 'By Ground' , 8 , NULL , 'true' , '9/6/2009 6:31:42 PM', 125.0000 , 125.0000 , 125.0000 , 125.0000 , 1 , 17.5000 , 17.5000 , 17.5000 , 17.5000 , 0.0000 , 0.0000 , 0.0000 , 0.0000 , ) DELETEFROM [dbo].[Nop_Order]WHERE OrderID=5000SET IDENTITY_INSERT [dbo].[Nop_Order] OFF[/code]Incorrect syntax near ')'. Thanks for looking at this for me.. Im starting to understand what Im looking at now ..lol So close, I can feel it.. |
 |
|
|
rajdaksha
Aged Yak Warrior
595 Posts |
Posted - 2009-12-05 : 02:33:47
|
quote: Originally posted by Nathan_
SET IDENTITY_INSERT [dbo].[Nop_Order] ONINSERT [dbo].[Nop_Order] ( [OrderID] , [OrderGUID] , [OrderID] , [OrderGUID] , [CustomerID] , [CustomerLanguageID] , [OrderTax] , [OrderTotal] , [OrderDiscount] , [OrderTaxInCustomerCurrency] , [OrderTotalInCustomerCurrency] , [CustomerCurrencyCode] , [OrderWeight] , [AffiliateID] , [OrderStatusID] , [CardType] , [CardName] , [CardNumber] , [CardCVV2] , [CardExpirationMonth] , [CardExpirationYear] , [PaymentMethodID] , [PaymentMethodName] , [AuthorizationTransactionID] , [AuthorizationTransactionCode] , [AuthorizationTransactionResult] , [CaptureTransactionID] , [CaptureTransactionResult] , [PurchaseOrderNumber] , [PaymentStatusID] , [BillingFirstName] , [BillingLastName] , [BillingPhoneNumber] , [BillingEmail] , [BillingFaxNumber] , [BillingCompany] , [BillingAddress1] , [BillingAddress2] , [BillingCity] , [BillingStateProvince] , [BillingStateProvinceID] , [BillingZipPostalCode] , [BillingCountry] , [BillingCountryID] , [ShippingStatusID] , [ShippingFirstName] , [ShippingLastName] , [ShippingPhoneNumber] , [ShippingEmail] , [ShippingFaxNumber] , [ShippingCompany] , [ShippingAddress1] , [ShippingAddress2] , [ShippingCity] , [ShippingStateProvince] , [ShippingStateProvinceID] , [ShippingZipPostalCode] , [ShippingCountry] , [ShippingCountryID] , [ShippingMethod] , [ShippingRateComputationMethodID] , [ShippedDate] , [Deleted] , [CreatedOn] , [OrderSubtotalInclTax] , [OrderSubtotalExclTax] , [OrderSubtotalInclTaxInCustomerCurrency] , [OrderSubtotalExclTaxInCustomerCurrency] , [CustomerTaxDisplayTypeID] , [OrderShippingInclTax] , [OrderShippingExclTax] , [OrderShippingInclTaxInCustomerCurrency] , [OrderShippingExclTaxInCustomerCurrency] , [PaymentMethodAdditionalFeeInclTax] , [PaymentMethodAdditionalFeeExclTax] , [PaymentMethodAdditionalFeeInclTaxInCustomerCurrency], [PaymentMethodAdditionalFeeExclTaxInCustomerCurrency] ) VALUES ( 5000 , N'08058c7e-7fc2-479a-a004-85bd3a8072d2', 37,7, 0.0000 , 142.5000, 0.0000 , 0.0000 , 142.5000, 5 , 2.5 , 0, 10, NULL , NULL , NULL , NULL , 'mr8Id8P3LXM=' , 'mr8Id8P3LXM=' , 2 , 'PayPal Standard' , NULL , NULL , NULL , NULL , NULL , NULL , 10 , 'John', 'Smith', 1234567, 'admin@yourStore.com', NULL , 'Nop Solutions' , '21 West 52nd Street', null, 'New York', 'New York', 41,10021, 'United States', 1,20, 'John', 'Smith' , 12345678 , 'admin@yourStore.com', NULL , 'Nop Solutions' , '21 West 52nd Street', NULL , 'New York' , 'New York' , 41,10021, 'United States' , 1 , 'By Ground' , 8 , NULL , 'true' , '9/6/2009 6:31:42 PM', 125.0000 , 125.0000 , 125.0000 , 125.0000 , 1 , 17.5000 , 17.5000 , 17.5000 , 17.5000 , 0.0000 , 0.0000 , 0.0000 , 0.0000 , --Please remove this comma then run ) DELETEFROM [dbo].[Nop_Order]WHERE OrderID=5000SET IDENTITY_INSERT [dbo].[Nop_Order] OFF Incorrect syntax near ')'. Thanks for looking at this for me.. Im starting to understand what Im looking at now ..lol So close, I can feel it..
-------------------------R... |
 |
|
|
Nathan_
Starting Member
5 Posts |
Posted - 2009-12-06 : 22:56:48
|
| Thank you for all your help !! I finally got it to work, but forgot to save the script befor it ran, so I cant show you what I finally got to work..Turned out the NULL value would not work, so I had to replace them all with '1' then it works . :-p |
 |
|
|
|
|
|