How do I fix this incorrect syntax in my Code
When I run my code, I keep getting an error
Incorrect syntax near the keyword 'CONVERT'
I've checked & rechecked and I can't get where the error is
INSERT INTO stock (ID, GOODSNAME, QUANTITY, PRICE, [DESCRIPTION], GOODSIMAGE, REGDATE)
SELECT
'STOCK-5', 'Pine by 150 Wipes', 120,600.00, 'To Clean Faeces',
BulkColumn
FROM
Openrowset (Bulk 'ImageDirectoryIMG_20180206_113030.jpg', Single_Blob) AS tb_picture,
CONVERT(date, '2011/11/11')
sql sql-server
add a comment |
When I run my code, I keep getting an error
Incorrect syntax near the keyword 'CONVERT'
I've checked & rechecked and I can't get where the error is
INSERT INTO stock (ID, GOODSNAME, QUANTITY, PRICE, [DESCRIPTION], GOODSIMAGE, REGDATE)
SELECT
'STOCK-5', 'Pine by 150 Wipes', 120,600.00, 'To Clean Faeces',
BulkColumn
FROM
Openrowset (Bulk 'ImageDirectoryIMG_20180206_113030.jpg', Single_Blob) AS tb_picture,
CONVERT(date, '2011/11/11')
sql sql-server
2
Can you post the Stick table Schema? @Mr. Royal
– Mark Kram
Jan 20 at 12:12
also,CONVERT
had nuances, since your date is confusing enough, please check this QA. confusing enough: computer might unable distinguish the month and day apart.
– Bagus Tesa
Jan 20 at 12:15
1
you have six columns in the insertion list but seven comma sepearted values in th select list.
– Barbaros Özhan
Jan 20 at 12:24
add a comment |
When I run my code, I keep getting an error
Incorrect syntax near the keyword 'CONVERT'
I've checked & rechecked and I can't get where the error is
INSERT INTO stock (ID, GOODSNAME, QUANTITY, PRICE, [DESCRIPTION], GOODSIMAGE, REGDATE)
SELECT
'STOCK-5', 'Pine by 150 Wipes', 120,600.00, 'To Clean Faeces',
BulkColumn
FROM
Openrowset (Bulk 'ImageDirectoryIMG_20180206_113030.jpg', Single_Blob) AS tb_picture,
CONVERT(date, '2011/11/11')
sql sql-server
When I run my code, I keep getting an error
Incorrect syntax near the keyword 'CONVERT'
I've checked & rechecked and I can't get where the error is
INSERT INTO stock (ID, GOODSNAME, QUANTITY, PRICE, [DESCRIPTION], GOODSIMAGE, REGDATE)
SELECT
'STOCK-5', 'Pine by 150 Wipes', 120,600.00, 'To Clean Faeces',
BulkColumn
FROM
Openrowset (Bulk 'ImageDirectoryIMG_20180206_113030.jpg', Single_Blob) AS tb_picture,
CONVERT(date, '2011/11/11')
sql sql-server
sql sql-server
edited Jan 20 at 20:34
Dale Burrell
3,17132451
3,17132451
asked Jan 20 at 12:10
Mr. RoyalMr. Royal
147
147
2
Can you post the Stick table Schema? @Mr. Royal
– Mark Kram
Jan 20 at 12:12
also,CONVERT
had nuances, since your date is confusing enough, please check this QA. confusing enough: computer might unable distinguish the month and day apart.
– Bagus Tesa
Jan 20 at 12:15
1
you have six columns in the insertion list but seven comma sepearted values in th select list.
– Barbaros Özhan
Jan 20 at 12:24
add a comment |
2
Can you post the Stick table Schema? @Mr. Royal
– Mark Kram
Jan 20 at 12:12
also,CONVERT
had nuances, since your date is confusing enough, please check this QA. confusing enough: computer might unable distinguish the month and day apart.
– Bagus Tesa
Jan 20 at 12:15
1
you have six columns in the insertion list but seven comma sepearted values in th select list.
– Barbaros Özhan
Jan 20 at 12:24
2
2
Can you post the Stick table Schema? @Mr. Royal
– Mark Kram
Jan 20 at 12:12
Can you post the Stick table Schema? @Mr. Royal
– Mark Kram
Jan 20 at 12:12
also,
CONVERT
had nuances, since your date is confusing enough, please check this QA. confusing enough: computer might unable distinguish the month and day apart.– Bagus Tesa
Jan 20 at 12:15
also,
CONVERT
had nuances, since your date is confusing enough, please check this QA. confusing enough: computer might unable distinguish the month and day apart.– Bagus Tesa
Jan 20 at 12:15
1
1
you have six columns in the insertion list but seven comma sepearted values in th select list.
– Barbaros Özhan
Jan 20 at 12:24
you have six columns in the insertion list but seven comma sepearted values in th select list.
– Barbaros Özhan
Jan 20 at 12:24
add a comment |
3 Answers
3
active
oldest
votes
That expression belongs in the SELECT
clause not the FROM
clause:
INSERT INTO stock (ID, GOODSNAME, QUANTITY, PRICE, [DESCRIPTION], GOODSIMAGE, REGDATE)
SELECT 'STOCK-5', 'Pine by 150 Wipes', 120,600.00,
'To Clean Faeces', BulkColumn, CONVERT(date,'2011/11/11')
FROM Openrowset(Bulk 'ImageDirectoryIMG_20180206_113030.jpg', Single_Blob) tb_picture
add a comment |
Here is your current query slightly better formatted
INSERT INTO stock (ID, GOODSNAME, QUANTITY, PRICE, [DESCRIPTION], GOODSIMAGE)
SELECT 'STOCK-5','Pine by 150 Wipes', 120,600.00,'To Clean Faeces', BulkColumn
FROM Openrowset (Bulk 'ImageDirectoryIMG_20180206_113030.jpg', Single_Blob) as tb_picture
, CONVERT(date,'2011/11/11')
The "as tb_picture" in this query is a table alias, not a selection list alias. The FROM clause has passed, you cannot simply add another expression after that. It should probably go between "BulkColumn" and "FROM"
add a comment |
Try below query:
INSERT INTO stock (
ID, GOODSNAME, QUANTITY, PRICE, [DESCRIPTION],
GOODSIMAGE, REGDATE
)
SELECT
'STOCK-5',
'Pine by 150 Wipes',
120,
600.00,
'To Clean Faeces',
BulkColumn,
Convert(date, '2011/11/11')
FROM
Openrowset (
Bulk 'ImageDirectoryIMG_20180206_113030.jpg',
Single_Blob
) as tb_picture
Mistakes corrected
– Mr. Royal
Jan 20 at 14:05
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54276284%2fhow-do-i-fix-this-incorrect-syntax-in-my-code%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
That expression belongs in the SELECT
clause not the FROM
clause:
INSERT INTO stock (ID, GOODSNAME, QUANTITY, PRICE, [DESCRIPTION], GOODSIMAGE, REGDATE)
SELECT 'STOCK-5', 'Pine by 150 Wipes', 120,600.00,
'To Clean Faeces', BulkColumn, CONVERT(date,'2011/11/11')
FROM Openrowset(Bulk 'ImageDirectoryIMG_20180206_113030.jpg', Single_Blob) tb_picture
add a comment |
That expression belongs in the SELECT
clause not the FROM
clause:
INSERT INTO stock (ID, GOODSNAME, QUANTITY, PRICE, [DESCRIPTION], GOODSIMAGE, REGDATE)
SELECT 'STOCK-5', 'Pine by 150 Wipes', 120,600.00,
'To Clean Faeces', BulkColumn, CONVERT(date,'2011/11/11')
FROM Openrowset(Bulk 'ImageDirectoryIMG_20180206_113030.jpg', Single_Blob) tb_picture
add a comment |
That expression belongs in the SELECT
clause not the FROM
clause:
INSERT INTO stock (ID, GOODSNAME, QUANTITY, PRICE, [DESCRIPTION], GOODSIMAGE, REGDATE)
SELECT 'STOCK-5', 'Pine by 150 Wipes', 120,600.00,
'To Clean Faeces', BulkColumn, CONVERT(date,'2011/11/11')
FROM Openrowset(Bulk 'ImageDirectoryIMG_20180206_113030.jpg', Single_Blob) tb_picture
That expression belongs in the SELECT
clause not the FROM
clause:
INSERT INTO stock (ID, GOODSNAME, QUANTITY, PRICE, [DESCRIPTION], GOODSIMAGE, REGDATE)
SELECT 'STOCK-5', 'Pine by 150 Wipes', 120,600.00,
'To Clean Faeces', BulkColumn, CONVERT(date,'2011/11/11')
FROM Openrowset(Bulk 'ImageDirectoryIMG_20180206_113030.jpg', Single_Blob) tb_picture
edited Jan 20 at 21:16
Mr. Royal
147
147
answered Jan 20 at 12:54
Gordon LinoffGordon Linoff
773k35306408
773k35306408
add a comment |
add a comment |
Here is your current query slightly better formatted
INSERT INTO stock (ID, GOODSNAME, QUANTITY, PRICE, [DESCRIPTION], GOODSIMAGE)
SELECT 'STOCK-5','Pine by 150 Wipes', 120,600.00,'To Clean Faeces', BulkColumn
FROM Openrowset (Bulk 'ImageDirectoryIMG_20180206_113030.jpg', Single_Blob) as tb_picture
, CONVERT(date,'2011/11/11')
The "as tb_picture" in this query is a table alias, not a selection list alias. The FROM clause has passed, you cannot simply add another expression after that. It should probably go between "BulkColumn" and "FROM"
add a comment |
Here is your current query slightly better formatted
INSERT INTO stock (ID, GOODSNAME, QUANTITY, PRICE, [DESCRIPTION], GOODSIMAGE)
SELECT 'STOCK-5','Pine by 150 Wipes', 120,600.00,'To Clean Faeces', BulkColumn
FROM Openrowset (Bulk 'ImageDirectoryIMG_20180206_113030.jpg', Single_Blob) as tb_picture
, CONVERT(date,'2011/11/11')
The "as tb_picture" in this query is a table alias, not a selection list alias. The FROM clause has passed, you cannot simply add another expression after that. It should probably go between "BulkColumn" and "FROM"
add a comment |
Here is your current query slightly better formatted
INSERT INTO stock (ID, GOODSNAME, QUANTITY, PRICE, [DESCRIPTION], GOODSIMAGE)
SELECT 'STOCK-5','Pine by 150 Wipes', 120,600.00,'To Clean Faeces', BulkColumn
FROM Openrowset (Bulk 'ImageDirectoryIMG_20180206_113030.jpg', Single_Blob) as tb_picture
, CONVERT(date,'2011/11/11')
The "as tb_picture" in this query is a table alias, not a selection list alias. The FROM clause has passed, you cannot simply add another expression after that. It should probably go between "BulkColumn" and "FROM"
Here is your current query slightly better formatted
INSERT INTO stock (ID, GOODSNAME, QUANTITY, PRICE, [DESCRIPTION], GOODSIMAGE)
SELECT 'STOCK-5','Pine by 150 Wipes', 120,600.00,'To Clean Faeces', BulkColumn
FROM Openrowset (Bulk 'ImageDirectoryIMG_20180206_113030.jpg', Single_Blob) as tb_picture
, CONVERT(date,'2011/11/11')
The "as tb_picture" in this query is a table alias, not a selection list alias. The FROM clause has passed, you cannot simply add another expression after that. It should probably go between "BulkColumn" and "FROM"
answered Jan 20 at 12:55
Gert-JanGert-Jan
446
446
add a comment |
add a comment |
Try below query:
INSERT INTO stock (
ID, GOODSNAME, QUANTITY, PRICE, [DESCRIPTION],
GOODSIMAGE, REGDATE
)
SELECT
'STOCK-5',
'Pine by 150 Wipes',
120,
600.00,
'To Clean Faeces',
BulkColumn,
Convert(date, '2011/11/11')
FROM
Openrowset (
Bulk 'ImageDirectoryIMG_20180206_113030.jpg',
Single_Blob
) as tb_picture
Mistakes corrected
– Mr. Royal
Jan 20 at 14:05
add a comment |
Try below query:
INSERT INTO stock (
ID, GOODSNAME, QUANTITY, PRICE, [DESCRIPTION],
GOODSIMAGE, REGDATE
)
SELECT
'STOCK-5',
'Pine by 150 Wipes',
120,
600.00,
'To Clean Faeces',
BulkColumn,
Convert(date, '2011/11/11')
FROM
Openrowset (
Bulk 'ImageDirectoryIMG_20180206_113030.jpg',
Single_Blob
) as tb_picture
Mistakes corrected
– Mr. Royal
Jan 20 at 14:05
add a comment |
Try below query:
INSERT INTO stock (
ID, GOODSNAME, QUANTITY, PRICE, [DESCRIPTION],
GOODSIMAGE, REGDATE
)
SELECT
'STOCK-5',
'Pine by 150 Wipes',
120,
600.00,
'To Clean Faeces',
BulkColumn,
Convert(date, '2011/11/11')
FROM
Openrowset (
Bulk 'ImageDirectoryIMG_20180206_113030.jpg',
Single_Blob
) as tb_picture
Try below query:
INSERT INTO stock (
ID, GOODSNAME, QUANTITY, PRICE, [DESCRIPTION],
GOODSIMAGE, REGDATE
)
SELECT
'STOCK-5',
'Pine by 150 Wipes',
120,
600.00,
'To Clean Faeces',
BulkColumn,
Convert(date, '2011/11/11')
FROM
Openrowset (
Bulk 'ImageDirectoryIMG_20180206_113030.jpg',
Single_Blob
) as tb_picture
edited Jan 20 at 14:25
Prashant Pimpale
3,3423830
3,3423830
answered Jan 20 at 14:04
Mr. RoyalMr. Royal
147
147
Mistakes corrected
– Mr. Royal
Jan 20 at 14:05
add a comment |
Mistakes corrected
– Mr. Royal
Jan 20 at 14:05
Mistakes corrected
– Mr. Royal
Jan 20 at 14:05
Mistakes corrected
– Mr. Royal
Jan 20 at 14:05
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54276284%2fhow-do-i-fix-this-incorrect-syntax-in-my-code%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
2
Can you post the Stick table Schema? @Mr. Royal
– Mark Kram
Jan 20 at 12:12
also,
CONVERT
had nuances, since your date is confusing enough, please check this QA. confusing enough: computer might unable distinguish the month and day apart.– Bagus Tesa
Jan 20 at 12:15
1
you have six columns in the insertion list but seven comma sepearted values in th select list.
– Barbaros Özhan
Jan 20 at 12:24