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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. Database & SysAdmin
  3. Database
  4. SQL Script

SQL Script

Scheduled Pinned Locked Moved Database
databasetoolsquestion
6 Posts 4 Posters 1 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
    Subramaniam s V
    wrote on last edited by
    #1

    I have written a SQL script to run from my code using executesql command..meaning that i have framed the sql script and have it in a string and i pass the string to the ExecuteSQL funtion which executes my sql script..my scripts functionality is to insert some 1000 rows into a table..when my code executes the script runs(which i came to know from profiler) but the rows are not inserting.. can anyone tell me as wat could be the reason?? NOTE: there are no conditions in the script that ll prevent the insertion happenning its a bit urgent.. thanks in advance..

    I C E 3 Replies Last reply
    0
    • S Subramaniam s V

      I have written a SQL script to run from my code using executesql command..meaning that i have framed the sql script and have it in a string and i pass the string to the ExecuteSQL funtion which executes my sql script..my scripts functionality is to insert some 1000 rows into a table..when my code executes the script runs(which i came to know from profiler) but the rows are not inserting.. can anyone tell me as wat could be the reason?? NOTE: there are no conditions in the script that ll prevent the insertion happenning its a bit urgent.. thanks in advance..

      I Offline
      I Offline
      Igor Sukhov
      wrote on last edited by
      #2

      I suspect there is an error in the script. Best regards, ----------- Igor Sukhovhttp://sukhov.net

      1 Reply Last reply
      0
      • S Subramaniam s V

        I have written a SQL script to run from my code using executesql command..meaning that i have framed the sql script and have it in a string and i pass the string to the ExecuteSQL funtion which executes my sql script..my scripts functionality is to insert some 1000 rows into a table..when my code executes the script runs(which i came to know from profiler) but the rows are not inserting.. can anyone tell me as wat could be the reason?? NOTE: there are no conditions in the script that ll prevent the insertion happenning its a bit urgent.. thanks in advance..

        C Offline
        C Offline
        Colin Angus Mackay
        wrote on last edited by
        #3

        Without the script (which will be a bit long) or an error message there isn't much more that we can help with. If it works in Query Analyser but not through ExecuteSql then the immediate thought that springs to mind is: Do you have any "GO" statements? GO statements are not part of SQL but a preprocessing instruction to Query Analyser to tell it where to split long scripts up into individual batches - it then sends the smaller chunks of SQL to the server. On my blog is a demonstration of running SQL via SqlCommand with GO delimiters[^]. If I've guessed your problem correctly it might help.


        Scottish Developers events: * .NET debugging, tracing and instrumentation by Duncan Edwards Jones and Code Coverage in .NET by Craig Murphy * Developer Day Scotland: are you interested in speaking or attending? My: Website | Blog

        S 1 Reply Last reply
        0
        • C Colin Angus Mackay

          Without the script (which will be a bit long) or an error message there isn't much more that we can help with. If it works in Query Analyser but not through ExecuteSql then the immediate thought that springs to mind is: Do you have any "GO" statements? GO statements are not part of SQL but a preprocessing instruction to Query Analyser to tell it where to split long scripts up into individual batches - it then sends the smaller chunks of SQL to the server. On my blog is a demonstration of running SQL via SqlCommand with GO delimiters[^]. If I've guessed your problem correctly it might help.


          Scottish Developers events: * .NET debugging, tracing and instrumentation by Duncan Edwards Jones and Code Coverage in .NET by Craig Murphy * Developer Day Scotland: are you interested in speaking or attending? My: Website | Blog

          S Offline
          S Offline
          Subramaniam s V
          wrote on last edited by
          #4

          the script doesnt have any error.. My script is running fine in Query Analyzer and it doesnt have any GO statements..so is GO statement required for my script?? My script will be a maximum of 70 lines thats it..kindly suggest.. any other clues pls let me know..

          C 1 Reply Last reply
          0
          • S Subramaniam s V

            the script doesnt have any error.. My script is running fine in Query Analyzer and it doesnt have any GO statements..so is GO statement required for my script?? My script will be a maximum of 70 lines thats it..kindly suggest.. any other clues pls let me know..

            C Offline
            C Offline
            Colin Angus Mackay
            wrote on last edited by
            #5

            Subramaniam s.V. wrote:

            the script doesnt have any error..

            Well, what does happen?

            Subramaniam s.V. wrote:

            so is GO statement required for my script??

            No. To repeat in brief: GO statements are NOT part of SQL.

            Subramaniam s.V. wrote:

            My script will be

            Future tense! You've not written it yet?! (Okay, I'll assume that was a typo) Without knowing more I cannot help much. Something to check: Is your connection string pointing to the correct server and database?


            Scottish Developers events: * .NET debugging, tracing and instrumentation by Duncan Edwards Jones and Code Coverage in .NET by Craig Murphy * Developer Day Scotland: are you interested in speaking or attending? My: Website | Blog

            1 Reply Last reply
            0
            • S Subramaniam s V

              I have written a SQL script to run from my code using executesql command..meaning that i have framed the sql script and have it in a string and i pass the string to the ExecuteSQL funtion which executes my sql script..my scripts functionality is to insert some 1000 rows into a table..when my code executes the script runs(which i came to know from profiler) but the rows are not inserting.. can anyone tell me as wat could be the reason?? NOTE: there are no conditions in the script that ll prevent the insertion happenning its a bit urgent.. thanks in advance..

              E Offline
              E Offline
              Edbert P
              wrote on last edited by
              #6

              Just for another thought, if you are using MSSQL 2000 there is a limit of 4000 characters for nvarchar (unicode 'wide' varchar) and 8000 for regular varchar. Your string may be longer than that and as a result it gets truncated when passed to a stored procedure. "Democracy is two wolves and a sheep voting on what to have for dinner" - Ross Edbert Sydney, Australia

              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