on 07-14-2011 9:30 AM
Hi,
I have a query to Insert Bom as below
INSERT INTO BOMS
(
OrderID,
Phase,
PositionNumber,
MaterialNumber,
MaterialShortText,
Batch,
ReservationNumber,
ReservationItem,
Quantity,
UOM
) VALUES (
[Param.1],
'[Param.2],
'[Param.3]',
'[Param.4]',
'[Param.5]',
'[Param.6]',
'[Param.7]',
'[Param.8]',
'[Param.9]',
[Param.10]
)
When I execute it, I am getting error as incorrect syntax near ','
I have a confusionusing single quotes around the Param, can someone help me to solve this and make me understand when to use quotes and when not.
Thanks,
Jai
Hi Jai,
If you are using string datatype like varchar,nvarchar then you should use quotes.
with numbers it is not required.
but even if you will use quotes with numbers and date, sql will convert it to its assigned type.
Try this query
INSERT INTO BOMS
(
OrderID,
Phase,
PositionNumber,
MaterialNumber,
MaterialShortText,
Batch,
ReservationNumber,
ReservationItem,
Quantity,
UOM
) VALUES (
'[Param.1]',
'[Param.2]',
'[Param.3]',
'[Param.4]',
'[Param.5]',
'[Param.6]',
'[Param.7]',
'[Param.8]',
'[Param.9]',
'[Param.10]'
)
Edited by: Anshul Sahu on Jul 14, 2011 10:47 AM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Anshul,
I get now the error saying " Error converting data type varchar to numeric". I have TYPE_NAME defined as below
ID-int identity
OrderID - bigint
positionnumber- varchar
materialnumber - varchar
materialshorttext - varchar
batch - varhar
reservationnumber - varchar
reservationitem - varchar
Quantity - decimal
UOM - varchar
phase - varchar
"ID" is a primary key
Thanks,
Jai
Edited by: jaimalhotra on Jul 14, 2011 10:59 AM
Hi Jai,
Sorry I did not read your post carefully enough! Using MSSQL 2008, I created a table with a column of type bigint and decimal, and an ID column that is the identity. I had no problem inserting into MII using
[Param.X]
(unquoted).
Have you verified against the database that the datatypes are as you indicated? I assume you are using Command mode inside of MII. On the Parameters screen, are you using any quotes there (as these would be unnecessary)?
The only datatype I can see might be a little tricky is the decimal type - is it possible to try changing the Quantity to another type for experimental purposes?
- Diana
Not sure how to escape the brackets so they show correctly!
Edited by: Diana Hoppe on Jul 14, 2011 10:01 AM
User | Count |
---|---|
3 | |
3 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.