Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. A couple of queries in SQL,Please Help..

A couple of queries in SQL,Please Help..

Scheduled Pinned Locked Moved ASP.NET
databasehelpquestionannouncement
4 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    SIJUTHOMASP
    wrote on last edited by
    #1

    Hai, The following is my queries. 1: Is it possible to have check constraint with a local variable? 2: Given the following scenario: I have three columns in a table ,say ID int,name varchar, address varchar, and I added 10 records into that table keeping ID colums NULL.Later I want to add values to ID columns 1 thru 10 but with a single update query.(It doesn't means you are bound to use only 1 satement in the batch, no loop permitted ) Please show me a right way.Thanks very much. Thank You, Rahul.P.Menon.

    G 1 Reply Last reply
    0
    • S SIJUTHOMASP

      Hai, The following is my queries. 1: Is it possible to have check constraint with a local variable? 2: Given the following scenario: I have three columns in a table ,say ID int,name varchar, address varchar, and I added 10 records into that table keeping ID colums NULL.Later I want to add values to ID columns 1 thru 10 but with a single update query.(It doesn't means you are bound to use only 1 satement in the batch, no loop permitted ) Please show me a right way.Thanks very much. Thank You, Rahul.P.Menon.

      G Offline
      G Offline
      goyal manish
      wrote on last edited by
      #2

      just use cursor or while loop in urs stored procedure.

      S 1 Reply Last reply
      0
      • G goyal manish

        just use cursor or while loop in urs stored procedure.

        S Offline
        S Offline
        SIJUTHOMASP
        wrote on last edited by
        #3

        Hi Goyal, Can you please explain with an example or with the code snippet.Thanks very much for the reply. Thank You, Rahul.P.Menon.

        G 1 Reply Last reply
        0
        • S SIJUTHOMASP

          Hi Goyal, Can you please explain with an example or with the code snippet.Thanks very much for the reply. Thank You, Rahul.P.Menon.

          G Offline
          G Offline
          goyal manish
          wrote on last edited by
          #4

          for eg. in urs stored procedure use following declare @temp int set @temp = select count(*) from table declare @@count int set @count = 1 while(@temp >0) Begin Insert query set @temp = @temp-1 End

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups