Having trouble with insert query on linked server The Next CEO of Stack OverflowWorking Linked...

Is it okay to majorly distort historical facts while writing a fiction story?

What did we know about the Kessel run before the prequels?

Bartok - Syncopation (1): Meaning of notes in between Grand Staff

How did people program for Consoles with multiple CPUs?

Why don't programming languages automatically manage the synchronous/asynchronous problem?

Can a Bladesinger Wizard use Bladesong with a Hand Crossbow?

Why do remote US companies require working in the US?

Math-accent symbol over parentheses enclosing accented symbol (amsmath)

What was the first Unix version to run on a microcomputer?

Why did CATV standarize in 75 ohms and everyone else in 50?

Is micro rebar a better way to reinforce concrete than rebar?

Plot of histogram similar to output from @risk

Is wanting to ask what to write an indication that you need to change your story?

Would a grinding machine be a simple and workable propulsion system for an interplanetary spacecraft?

Would be okay to drive on this tire?

Do I need to write [sic] when a number is less than 10 but isn't written out?

If Nick Fury and Coulson already knew about aliens (Kree and Skrull) why did they wait until Thor's appearance to start making weapons?

Can we say or write : "No, it'sn't"?

WOW air has ceased operation, can I get my tickets refunded?

Which one is the true statement?

Why is quantifier elimination desirable for a given theory?

How to avoid supervisors with prejudiced views?

Why this way of making earth uninhabitable in Interstellar?

Is it professional to write unrelated content in an almost-empty email?



Having trouble with insert query on linked server



The Next CEO of Stack OverflowWorking Linked Server Query fails in sp_send_dbmailChange rowguidcol property to a different columnUsing CASE in CHECK ConstraintSQL Server: efficient query with (double) linked serversInsert query with a subqueryTwo columns with and without index in where clause - How index workslinked server operationNever Ending OLEDB Wait for Linked ServerInsert data through linked server into two remote related tablesTLS 1.2 breaks SQL Server linked servers












1















Two servers. Server A and Server B both has database named KPS. KPS has two tables complaint and attachment. KPS database on server A gets the value from the Web.



Both table if the submitted value = 1 then run the insert query which will insert the col1,col2 and col3 from Server A KPS to Server B KPS. They both are linked server. Both table attachment and complaint submit value needs to be 1 if it is 0 then do not insert. There will be two insert query one for complaint and one for attachment.



Can i also check that i m not inserting same data over and over ?



Thank you..










share|improve this question
















bumped to the homepage by Community 28 secs ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.




















    1















    Two servers. Server A and Server B both has database named KPS. KPS has two tables complaint and attachment. KPS database on server A gets the value from the Web.



    Both table if the submitted value = 1 then run the insert query which will insert the col1,col2 and col3 from Server A KPS to Server B KPS. They both are linked server. Both table attachment and complaint submit value needs to be 1 if it is 0 then do not insert. There will be two insert query one for complaint and one for attachment.



    Can i also check that i m not inserting same data over and over ?



    Thank you..










    share|improve this question
















    bumped to the homepage by Community 28 secs ago


    This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.


















      1












      1








      1








      Two servers. Server A and Server B both has database named KPS. KPS has two tables complaint and attachment. KPS database on server A gets the value from the Web.



      Both table if the submitted value = 1 then run the insert query which will insert the col1,col2 and col3 from Server A KPS to Server B KPS. They both are linked server. Both table attachment and complaint submit value needs to be 1 if it is 0 then do not insert. There will be two insert query one for complaint and one for attachment.



      Can i also check that i m not inserting same data over and over ?



      Thank you..










      share|improve this question
















      Two servers. Server A and Server B both has database named KPS. KPS has two tables complaint and attachment. KPS database on server A gets the value from the Web.



      Both table if the submitted value = 1 then run the insert query which will insert the col1,col2 and col3 from Server A KPS to Server B KPS. They both are linked server. Both table attachment and complaint submit value needs to be 1 if it is 0 then do not insert. There will be two insert query one for complaint and one for attachment.



      Can i also check that i m not inserting same data over and over ?



      Thank you..







      sql-server






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Jul 24 '15 at 15:00









      Kin

      54.1k481192




      54.1k481192










      asked Jul 24 '15 at 14:49









      KrishKrish

      62




      62





      bumped to the homepage by Community 28 secs ago


      This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.







      bumped to the homepage by Community 28 secs ago


      This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
























          2 Answers
          2






          active

          oldest

          votes


















          0














          What is the need to have two servers with the same database and the same information?
          The Two databases receive data from system?



          It would not be the case that you look at the SQL Server Replication?



          https://msdn.microsoft.com/en-us/library/ms151198(v=sql.105).aspx



          If it don't fit try implement a trigger that do it for you.






          share|improve this answer
























          • The data comes from the application and for some reason if i put the trigger it doesnt let the data come to the server from the application . There are two servers because of security concern...

            – Krish
            Jul 24 '15 at 18:09






          • 1





            Try SQL Server Replication.

            – Krismorte
            Jul 24 '15 at 21:36



















          0














          So i assume that you already have the queries to insert the data. So the question is really "Can i also check that i m not inserting same data over and over ?".



          There are a couple of ways you can do this. One simple way is to create a constraint on the columns in your table. Let's assume that they are col1,col2 and col3. So you could create a unique constraint on the table like this :



          alter table table_name add constraint Constraint_Name unique(col1,col2,col3)



          A composite primary key will also achieve this, but you may already be using the primary key in a different column.






          share|improve this answer
























            Your Answer








            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "182"
            };
            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: false,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: null,
            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%2fdba.stackexchange.com%2fquestions%2f108019%2fhaving-trouble-with-insert-query-on-linked-server%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            2 Answers
            2






            active

            oldest

            votes








            2 Answers
            2






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            0














            What is the need to have two servers with the same database and the same information?
            The Two databases receive data from system?



            It would not be the case that you look at the SQL Server Replication?



            https://msdn.microsoft.com/en-us/library/ms151198(v=sql.105).aspx



            If it don't fit try implement a trigger that do it for you.






            share|improve this answer
























            • The data comes from the application and for some reason if i put the trigger it doesnt let the data come to the server from the application . There are two servers because of security concern...

              – Krish
              Jul 24 '15 at 18:09






            • 1





              Try SQL Server Replication.

              – Krismorte
              Jul 24 '15 at 21:36
















            0














            What is the need to have two servers with the same database and the same information?
            The Two databases receive data from system?



            It would not be the case that you look at the SQL Server Replication?



            https://msdn.microsoft.com/en-us/library/ms151198(v=sql.105).aspx



            If it don't fit try implement a trigger that do it for you.






            share|improve this answer
























            • The data comes from the application and for some reason if i put the trigger it doesnt let the data come to the server from the application . There are two servers because of security concern...

              – Krish
              Jul 24 '15 at 18:09






            • 1





              Try SQL Server Replication.

              – Krismorte
              Jul 24 '15 at 21:36














            0












            0








            0







            What is the need to have two servers with the same database and the same information?
            The Two databases receive data from system?



            It would not be the case that you look at the SQL Server Replication?



            https://msdn.microsoft.com/en-us/library/ms151198(v=sql.105).aspx



            If it don't fit try implement a trigger that do it for you.






            share|improve this answer













            What is the need to have two servers with the same database and the same information?
            The Two databases receive data from system?



            It would not be the case that you look at the SQL Server Replication?



            https://msdn.microsoft.com/en-us/library/ms151198(v=sql.105).aspx



            If it don't fit try implement a trigger that do it for you.







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Jul 24 '15 at 16:39









            KrismorteKrismorte

            414212




            414212













            • The data comes from the application and for some reason if i put the trigger it doesnt let the data come to the server from the application . There are two servers because of security concern...

              – Krish
              Jul 24 '15 at 18:09






            • 1





              Try SQL Server Replication.

              – Krismorte
              Jul 24 '15 at 21:36



















            • The data comes from the application and for some reason if i put the trigger it doesnt let the data come to the server from the application . There are two servers because of security concern...

              – Krish
              Jul 24 '15 at 18:09






            • 1





              Try SQL Server Replication.

              – Krismorte
              Jul 24 '15 at 21:36

















            The data comes from the application and for some reason if i put the trigger it doesnt let the data come to the server from the application . There are two servers because of security concern...

            – Krish
            Jul 24 '15 at 18:09





            The data comes from the application and for some reason if i put the trigger it doesnt let the data come to the server from the application . There are two servers because of security concern...

            – Krish
            Jul 24 '15 at 18:09




            1




            1





            Try SQL Server Replication.

            – Krismorte
            Jul 24 '15 at 21:36





            Try SQL Server Replication.

            – Krismorte
            Jul 24 '15 at 21:36













            0














            So i assume that you already have the queries to insert the data. So the question is really "Can i also check that i m not inserting same data over and over ?".



            There are a couple of ways you can do this. One simple way is to create a constraint on the columns in your table. Let's assume that they are col1,col2 and col3. So you could create a unique constraint on the table like this :



            alter table table_name add constraint Constraint_Name unique(col1,col2,col3)



            A composite primary key will also achieve this, but you may already be using the primary key in a different column.






            share|improve this answer




























              0














              So i assume that you already have the queries to insert the data. So the question is really "Can i also check that i m not inserting same data over and over ?".



              There are a couple of ways you can do this. One simple way is to create a constraint on the columns in your table. Let's assume that they are col1,col2 and col3. So you could create a unique constraint on the table like this :



              alter table table_name add constraint Constraint_Name unique(col1,col2,col3)



              A composite primary key will also achieve this, but you may already be using the primary key in a different column.






              share|improve this answer


























                0












                0








                0







                So i assume that you already have the queries to insert the data. So the question is really "Can i also check that i m not inserting same data over and over ?".



                There are a couple of ways you can do this. One simple way is to create a constraint on the columns in your table. Let's assume that they are col1,col2 and col3. So you could create a unique constraint on the table like this :



                alter table table_name add constraint Constraint_Name unique(col1,col2,col3)



                A composite primary key will also achieve this, but you may already be using the primary key in a different column.






                share|improve this answer













                So i assume that you already have the queries to insert the data. So the question is really "Can i also check that i m not inserting same data over and over ?".



                There are a couple of ways you can do this. One simple way is to create a constraint on the columns in your table. Let's assume that they are col1,col2 and col3. So you could create a unique constraint on the table like this :



                alter table table_name add constraint Constraint_Name unique(col1,col2,col3)



                A composite primary key will also achieve this, but you may already be using the primary key in a different column.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Jul 25 '15 at 10:23









                Rajiv RajanRajiv Rajan

                1153




                1153






























                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to Database Administrators Stack Exchange!


                    • 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%2fdba.stackexchange.com%2fquestions%2f108019%2fhaving-trouble-with-insert-query-on-linked-server%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

                    Parapolítica Índice Antecedentes El escándalo Proceso judicial Consecuencias Véase...

                    How to remove border from elements in the last row?Targeting flex items on the last rowHow to vertically wrap...

                    Tecnologías entrañables Índice Antecedentes Desarrollo Tecnologías Entrañables en la...