Error on SQL Query (UPDATE) - Error varchar












1















I'm trying to execute a query on SQL Server:



UPDATE Clientes
SET CodigoCanal = IdDelegacion
WHERE (CodigoEmpresa = '1')


It is very simple, really. It's just to copy column A on column B (CodigoCanal and IdDelegacion).



But it gives me this error:
la conversion del tipo de datos varchar en datetime produjo un valor fuera del intervalo



The conversion of the varchar data type into datetime produced a value outside the range


UPDATE:
I add pictures of both column's properties:



First column

    First column



Second Column

    Second Column










share|improve this question

























  • It would be great if you could provide the error message in english..

    – holder
    Nov 16 '18 at 11:28











  • Please post the definition for the Clientes table.

    – Tim Biegeleisen
    Nov 16 '18 at 11:29






  • 1





    looks like CodigoCanal is a date data type and IdDelegacion is a varchar, IdDelegacion has a value in it that cannot be implicitly converted to a date

    – RegBes
    Nov 16 '18 at 11:31






  • 1





    Hi! This is message in english: the conversion of the varchar data type into datetime produced a value outside the range @holder

    – Albert Sunyer
    Nov 16 '18 at 11:32






  • 2





    @AlbertSunyer, if both columns are varchar, it is likely there's an update trigger on the table which is causing the error.

    – Dan Guzman
    Nov 16 '18 at 11:35
















1















I'm trying to execute a query on SQL Server:



UPDATE Clientes
SET CodigoCanal = IdDelegacion
WHERE (CodigoEmpresa = '1')


It is very simple, really. It's just to copy column A on column B (CodigoCanal and IdDelegacion).



But it gives me this error:
la conversion del tipo de datos varchar en datetime produjo un valor fuera del intervalo



The conversion of the varchar data type into datetime produced a value outside the range


UPDATE:
I add pictures of both column's properties:



First column

    First column



Second Column

    Second Column










share|improve this question

























  • It would be great if you could provide the error message in english..

    – holder
    Nov 16 '18 at 11:28











  • Please post the definition for the Clientes table.

    – Tim Biegeleisen
    Nov 16 '18 at 11:29






  • 1





    looks like CodigoCanal is a date data type and IdDelegacion is a varchar, IdDelegacion has a value in it that cannot be implicitly converted to a date

    – RegBes
    Nov 16 '18 at 11:31






  • 1





    Hi! This is message in english: the conversion of the varchar data type into datetime produced a value outside the range @holder

    – Albert Sunyer
    Nov 16 '18 at 11:32






  • 2





    @AlbertSunyer, if both columns are varchar, it is likely there's an update trigger on the table which is causing the error.

    – Dan Guzman
    Nov 16 '18 at 11:35














1












1








1








I'm trying to execute a query on SQL Server:



UPDATE Clientes
SET CodigoCanal = IdDelegacion
WHERE (CodigoEmpresa = '1')


It is very simple, really. It's just to copy column A on column B (CodigoCanal and IdDelegacion).



But it gives me this error:
la conversion del tipo de datos varchar en datetime produjo un valor fuera del intervalo



The conversion of the varchar data type into datetime produced a value outside the range


UPDATE:
I add pictures of both column's properties:



First column

    First column



Second Column

    Second Column










share|improve this question
















I'm trying to execute a query on SQL Server:



UPDATE Clientes
SET CodigoCanal = IdDelegacion
WHERE (CodigoEmpresa = '1')


It is very simple, really. It's just to copy column A on column B (CodigoCanal and IdDelegacion).



But it gives me this error:
la conversion del tipo de datos varchar en datetime produjo un valor fuera del intervalo



The conversion of the varchar data type into datetime produced a value outside the range


UPDATE:
I add pictures of both column's properties:



First column

    First column



Second Column

    Second Column







sql sql-server






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 16 '18 at 13:55









karel

2,28872732




2,28872732










asked Nov 16 '18 at 11:26









Albert SunyerAlbert Sunyer

143




143













  • It would be great if you could provide the error message in english..

    – holder
    Nov 16 '18 at 11:28











  • Please post the definition for the Clientes table.

    – Tim Biegeleisen
    Nov 16 '18 at 11:29






  • 1





    looks like CodigoCanal is a date data type and IdDelegacion is a varchar, IdDelegacion has a value in it that cannot be implicitly converted to a date

    – RegBes
    Nov 16 '18 at 11:31






  • 1





    Hi! This is message in english: the conversion of the varchar data type into datetime produced a value outside the range @holder

    – Albert Sunyer
    Nov 16 '18 at 11:32






  • 2





    @AlbertSunyer, if both columns are varchar, it is likely there's an update trigger on the table which is causing the error.

    – Dan Guzman
    Nov 16 '18 at 11:35



















  • It would be great if you could provide the error message in english..

    – holder
    Nov 16 '18 at 11:28











  • Please post the definition for the Clientes table.

    – Tim Biegeleisen
    Nov 16 '18 at 11:29






  • 1





    looks like CodigoCanal is a date data type and IdDelegacion is a varchar, IdDelegacion has a value in it that cannot be implicitly converted to a date

    – RegBes
    Nov 16 '18 at 11:31






  • 1





    Hi! This is message in english: the conversion of the varchar data type into datetime produced a value outside the range @holder

    – Albert Sunyer
    Nov 16 '18 at 11:32






  • 2





    @AlbertSunyer, if both columns are varchar, it is likely there's an update trigger on the table which is causing the error.

    – Dan Guzman
    Nov 16 '18 at 11:35

















It would be great if you could provide the error message in english..

– holder
Nov 16 '18 at 11:28





It would be great if you could provide the error message in english..

– holder
Nov 16 '18 at 11:28













Please post the definition for the Clientes table.

– Tim Biegeleisen
Nov 16 '18 at 11:29





Please post the definition for the Clientes table.

– Tim Biegeleisen
Nov 16 '18 at 11:29




1




1





looks like CodigoCanal is a date data type and IdDelegacion is a varchar, IdDelegacion has a value in it that cannot be implicitly converted to a date

– RegBes
Nov 16 '18 at 11:31





looks like CodigoCanal is a date data type and IdDelegacion is a varchar, IdDelegacion has a value in it that cannot be implicitly converted to a date

– RegBes
Nov 16 '18 at 11:31




1




1





Hi! This is message in english: the conversion of the varchar data type into datetime produced a value outside the range @holder

– Albert Sunyer
Nov 16 '18 at 11:32





Hi! This is message in english: the conversion of the varchar data type into datetime produced a value outside the range @holder

– Albert Sunyer
Nov 16 '18 at 11:32




2




2





@AlbertSunyer, if both columns are varchar, it is likely there's an update trigger on the table which is causing the error.

– Dan Guzman
Nov 16 '18 at 11:35





@AlbertSunyer, if both columns are varchar, it is likely there's an update trigger on the table which is causing the error.

– Dan Guzman
Nov 16 '18 at 11:35












3 Answers
3






active

oldest

votes


















0














Data tipes of your columns doesn't match. It looks like CordigoCanal is datetime and IdDelegacion varchar.






share|improve this answer
























  • Please, see pictures attached on post

    – Albert Sunyer
    Nov 16 '18 at 11:36



















0














The error message indicates that you are using a datetime datatype at some point.
Looking at the definition of your columns CodigoCanal and IdDelegacion those are of type varchar. The only columns that might have the datetime data type are:




  • Columns used in a trigger, as Dan Guzman mentioned

  • The CodigoEmpresa column (you did not post the definition here)






share|improve this answer































    0














    All right.
    I've checked on triggers, and there was 2 of them enabled.
    I disabled them, ran the query and then enabled again ;)



    Thank you for all your help!






    share|improve this answer
























      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%2f53336950%2ferror-on-sql-query-update-error-varchar%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









      0














      Data tipes of your columns doesn't match. It looks like CordigoCanal is datetime and IdDelegacion varchar.






      share|improve this answer
























      • Please, see pictures attached on post

        – Albert Sunyer
        Nov 16 '18 at 11:36
















      0














      Data tipes of your columns doesn't match. It looks like CordigoCanal is datetime and IdDelegacion varchar.






      share|improve this answer
























      • Please, see pictures attached on post

        – Albert Sunyer
        Nov 16 '18 at 11:36














      0












      0








      0







      Data tipes of your columns doesn't match. It looks like CordigoCanal is datetime and IdDelegacion varchar.






      share|improve this answer













      Data tipes of your columns doesn't match. It looks like CordigoCanal is datetime and IdDelegacion varchar.







      share|improve this answer












      share|improve this answer



      share|improve this answer










      answered Nov 16 '18 at 11:32









      misobabmisobab

      11




      11













      • Please, see pictures attached on post

        – Albert Sunyer
        Nov 16 '18 at 11:36



















      • Please, see pictures attached on post

        – Albert Sunyer
        Nov 16 '18 at 11:36

















      Please, see pictures attached on post

      – Albert Sunyer
      Nov 16 '18 at 11:36





      Please, see pictures attached on post

      – Albert Sunyer
      Nov 16 '18 at 11:36













      0














      The error message indicates that you are using a datetime datatype at some point.
      Looking at the definition of your columns CodigoCanal and IdDelegacion those are of type varchar. The only columns that might have the datetime data type are:




      • Columns used in a trigger, as Dan Guzman mentioned

      • The CodigoEmpresa column (you did not post the definition here)






      share|improve this answer




























        0














        The error message indicates that you are using a datetime datatype at some point.
        Looking at the definition of your columns CodigoCanal and IdDelegacion those are of type varchar. The only columns that might have the datetime data type are:




        • Columns used in a trigger, as Dan Guzman mentioned

        • The CodigoEmpresa column (you did not post the definition here)






        share|improve this answer


























          0












          0








          0







          The error message indicates that you are using a datetime datatype at some point.
          Looking at the definition of your columns CodigoCanal and IdDelegacion those are of type varchar. The only columns that might have the datetime data type are:




          • Columns used in a trigger, as Dan Guzman mentioned

          • The CodigoEmpresa column (you did not post the definition here)






          share|improve this answer













          The error message indicates that you are using a datetime datatype at some point.
          Looking at the definition of your columns CodigoCanal and IdDelegacion those are of type varchar. The only columns that might have the datetime data type are:




          • Columns used in a trigger, as Dan Guzman mentioned

          • The CodigoEmpresa column (you did not post the definition here)







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 16 '18 at 11:49









          cpt_doodcpt_dood

          2116




          2116























              0














              All right.
              I've checked on triggers, and there was 2 of them enabled.
              I disabled them, ran the query and then enabled again ;)



              Thank you for all your help!






              share|improve this answer




























                0














                All right.
                I've checked on triggers, and there was 2 of them enabled.
                I disabled them, ran the query and then enabled again ;)



                Thank you for all your help!






                share|improve this answer


























                  0












                  0








                  0







                  All right.
                  I've checked on triggers, and there was 2 of them enabled.
                  I disabled them, ran the query and then enabled again ;)



                  Thank you for all your help!






                  share|improve this answer













                  All right.
                  I've checked on triggers, and there was 2 of them enabled.
                  I disabled them, ran the query and then enabled again ;)



                  Thank you for all your help!







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Nov 16 '18 at 15:22









                  Albert SunyerAlbert Sunyer

                  143




                  143






























                      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%2f53336950%2ferror-on-sql-query-update-error-varchar%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

                      Bressuire

                      Vorschmack

                      Quarantine