How do I fix this incorrect syntax in my Code












0















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')









share|improve this question




















  • 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
















0















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')









share|improve this question




















  • 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














0












0








0








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')









share|improve this question
















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






share|improve this question















share|improve this question













share|improve this question




share|improve this question








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














  • 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












3 Answers
3






active

oldest

votes


















1














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





share|improve this answer

































    0














    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"






    share|improve this answer































      0














      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





      share|improve this answer


























      • Mistakes corrected

        – Mr. Royal
        Jan 20 at 14:05











      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
      });


      }
      });














      draft saved

      draft discarded


















      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









      1














      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





      share|improve this answer






























        1














        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





        share|improve this answer




























          1












          1








          1







          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





          share|improve this answer















          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






          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Jan 20 at 21:16









          Mr. Royal

          147




          147










          answered Jan 20 at 12:54









          Gordon LinoffGordon Linoff

          773k35306408




          773k35306408

























              0














              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"






              share|improve this answer




























                0














                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"






                share|improve this answer


























                  0












                  0








                  0







                  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"






                  share|improve this answer













                  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"







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Jan 20 at 12:55









                  Gert-JanGert-Jan

                  446




                  446























                      0














                      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





                      share|improve this answer


























                      • Mistakes corrected

                        – Mr. Royal
                        Jan 20 at 14:05
















                      0














                      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





                      share|improve this answer


























                      • Mistakes corrected

                        – Mr. Royal
                        Jan 20 at 14:05














                      0












                      0








                      0







                      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





                      share|improve this answer















                      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






                      share|improve this answer














                      share|improve this answer



                      share|improve this answer








                      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



















                      • 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


















                      draft saved

                      draft discarded




















































                      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.




                      draft saved


                      draft discarded














                      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





















































                      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







                      Popular posts from this blog

                      Homophylophilia

                      Updating UILabel text programmatically using a function

                      Cloud Functions - OpenCV Videocapture Read method fails for larger files from cloud storage