Professional Web Applications Themes

writing a row to a table on another database server + identity column - Microsoft SQL / MS SQL Server

Steve, In the Insert statemnt, explicitly specify the column names. some thing like Insert into [myserver].mysales.dbo.[myco_daily_orders] (ord_date,ytd_total_qty,....) Select ....... HTH Praveen Maddali, MCSD, MCDBA "Steve Chatham" <com> wrote in message news:uGLbjh#phx.gbl...  ord_type  defined  using  table  the  to  same ...

  1. #1

    Default Re: writing a row to a table on another database server + identity column

    Steve,

    In the Insert statemnt, explicitly specify the column names.


    some thing like
    Insert into [myserver].mysales.dbo.[myco_daily_orders]
    (ord_date,ytd_total_qty,....)
    Select .......



    HTH
    Praveen Maddali,
    MCSD, MCDBA


    "Steve Chatham" <com> wrote in message
    news:uGLbjh#phx.gbl... 
    ord_type 
    defined 
    using 
    table 
    the 
    to 
    same 


    praveen Guest

  2. #2

    Default Re: writing a row to a table on another database server + identity column

    Hello Steve !

    DIdn´t counted the values you want to insert but either you have to much are
    too few column in the Values to enter (And Rember, you can´t enter a
    identitiy without explicit specifying to insert it) If you don´t specify the
    columns in the the target table you have to enter a value for both even IF
    it is DEFAULT.

    Jens Süßmeyer


    Jens Guest

  3. #3

    Default Re: writing a row to a table on another database server + identity column

    Assuming my first column (the identity column) is called "ID", would I then
    have my statement read:

    Insert into [myserver].mysales.dbo.[myco_daily_orders]
    (ID, ord_date, ytd_total_qty,.....)
    Select
    and then what do I need to put for the ID field? If I explicityly specify
    the column names, and it is an identity column, what do i need to put in the
    select statement in order to put the next value into it?

    would select be:

    Select
    id
    whatever--ord-date-is,
    whatever-ytd-total-quantity-is
    or would ID be left out?

    Steve


    "praveen" <stph.net> wrote in message
    news:%23VDBvn%phx.gbl... [/ref]
    ord_type [/ref]
    ord_type [/ref]
    ord_type [/ref]
    ord_type [/ref]
    ord_type [/ref]
    ord_type [/ref]
    ord_type [/ref]
    ord_type [/ref]
    ord_type [/ref]
    ord_type [/ref]
    ord_type [/ref]
    ord_type 
    > ord_type 
    > defined 
    > using 
    > table 
    > the [/ref]
    it 
    > same 
    >
    >[/ref]


    Steve Guest

  4. #4

    Default Re: writing a row to a table on another database server + identity column

    Steve,

    Since the first column in your destination table is a Identity column , you
    can't insert values into that ( unless you have SET IDENTITY_INSERT ON for
    the table).

    So in the insert columns list specify all the columns in order except ID.
    Keep your select statement as it is.



    Insert into [myserver].mysales.dbo.[myco_daily_orders]
    (ord_date,ytd_total_qty,....)
    Select ord_date, ytd_total_qty
    .................................................

    Praveen
    MCSD, MCBA

    "Steve Chatham" <com> wrote in message
    news:uDgXkv#phx.gbl... 
    then 
    the [/ref]
    > ord_type [/ref]
    > ord_type [/ref]
    > ord_type [/ref]
    > ord_type [/ref]
    > ord_type [/ref]
    > ord_type [/ref]
    > ord_type [/ref]
    > ord_type [/ref]
    > ord_type [/ref]
    > ord_type [/ref]
    > ord_type [/ref]
    > ord_type 
    > > ord_type 
    > > defined 
    > > using 
    > > table [/ref][/ref]
    on [/ref]
    > it [/ref][/ref]
    the 
    > >
    > >[/ref]
    >
    >[/ref]


    praveen Guest

  5. #5

    Default Re: writing a row to a table on another database server + identity column

    That was it.

    Thank you for answering my question and for the clarification, also.

    Steve


    "praveen" <stph.net> wrote in message
    news:efHZW%23%phx.gbl... 
    you 
    > then [/ref]
    specify 
    > the 
    > > ord_type 
    > > ord_type 
    > > ord_type 
    > > ord_type 
    > > ord_type 
    > > ord_type 
    > > ord_type 
    > > ord_type [/ref][/ref]
    orders 
    > > ord_type 
    > > ord_type [/ref][/ref]
    orders 
    > > ord_type 
    > > ord_type [/ref][/ref]
    table [/ref][/ref]
    match [/ref]
    > on [/ref][/ref]
    causing [/ref]
    > the 
    > >
    > >[/ref]
    >
    >[/ref]


    Steve Guest

Similar Threads

  1. Replies: 6
    Last Post: April 16th, 10:37 PM
  2. Replies: 10
    Last Post: September 15th, 01:28 PM
  3. Valid MySQL database/table/column name regexp
    By Martin Lucas-Smith in forum PHP Development
    Replies: 3
    Last Post: August 15th, 07:41 PM
  4. Identity column
    By Frank in forum Microsoft SQL / MS SQL Server
    Replies: 2
    Last Post: July 17th, 07:23 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139