Preferences

  • Hi,

    sorry if it could be a simple.When 2 statement ( One 1 insert and 1 SELECT) excutes on SQL Server at same time.Which Statement will get 1st preferences.if not how i can set insert should take 1 st preferences.

    thanks

  • Arun - not sure if I understand the question correctly - is the insert and select being done on the same database object by the same person; on the same object by different people; on different objects ?! Directly in the database - or through an application GUI ?!

    Normally you would just do a "INSERT INTO Table(Col1, Col2 etc..)

    SELECT Col1, Col2 FROM otherTable"

    If this is not what you want you would have to add conditional logic so that the insert is done before the select - maybe in a stored procedure ?!







    **ASCII stupid question, get a stupid ANSI !!!**

  • Are you saying both are executing at the same time? If so, and they're coming from different connections, SQL Server is going to process the one that actually came first, regardless of the operation. If it's from the same connection, put the INSERT before the SELECT statement.

    K. Brian Kelley
    @kbriankelley

  • Thanks a lot

    i think bkelley is comment is fine.

  • Hi Arun,

    Bkelley comment is fine if u run both the select and insert statement on the same database. but this  in second aspect if u are executing insert and select statement on diffrent server will first check the linked server query table.

    from

    killer

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply