Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0"Incorrect Syntax near "Incorrect Syntax near 'GO'" in custom sql2k script
Previous
 
Next
New Post
1/30/2007 10:53 AM
 
Hi all,

I have a question, the below sql server script i have running on an asp.net site connected to a sqlserver2k errors out with the following error: "System.Data.SqlClient.SqlException: Line 10: Incorrect syntax near 'GO'."  As a solo programmer from home that does this as a hobby, I think i need a fresh set of eyes on my script as I've scoured through it trying to find out what is wrong.  I'm hardly an intermediate sql2k user so thought maybe if someone could be so kind to review my script below, it would help me fix the other procedures that I'm trying to create as well because they throw the same error.  This is from a dotnetnuke website and the {databaseOwner}[{objectQualifier} string placements should be correct as they work in other parts of my code such as creating the tables.

Any help would be appreciated!

Thx

******************** sql server2k script start********************
create procedure {databaseOwner}[{objectQualifier}Company
Name_GetCredits]

     @ModuleId int

as

SELECT ItemId = {databaseOwner}[{objectQualifier}CompanyName_tblReg].ItemId,
      ModuleId = {databaseOwner}[{objectQualifier}CompanyName_tblReg].ModuleId,
      UserId = {databaseOwner}[{objectQualifier}CompanyName_tblReg].UserId,
      UserCredits = {databaseOwner}[{objectQualifier}CompanyName_tblReg].UserCredits
       
from {databaseOwner}[{objectQualifier}CompanyName_tblReg] with (nolock) left outer join {databaseOwner}Users on {databaseOwner}[{objectQualifier}CompanyName_tblReg].UserId = {databaseOwner}Users.UserId
where  ModuleId = @ModuleId
GO
******************** sql server2k script end********************
 
New Post
1/30/2007 11:29 AM
 
Try putting some returns after the GO and after your last comment.

Chris Hammond
Former DNN Corp Employee, MVP, Core Team Member, Trustee
Christoc.com Software Solutions DotNetNuke Module Development, Upgrades and consulting.
dnnCHAT.com a chat room for DotNetNuke discussions
 
New Post
1/31/2007 10:25 AM
 
I removed GO from the sql for that single procedure creation and the script executed when i pasted into the SQL query tool in my local dnn installation.  Should I remove GO from all of my procedure creation statements?  Most module development guides show the go command in effect.  any ideas?
 
New Post
1/31/2007 2:08 PM
 

If you don't have at least an extra linebreak after the GO at the end of a script DNN's SQL execution will fail.

as you figured out, you can remove the GO, or put an extra line break after it.


Chris Hammond
Former DNN Corp Employee, MVP, Core Team Member, Trustee
Christoc.com Software Solutions DotNetNuke Module Development, Upgrades and consulting.
dnnCHAT.com a chat room for DotNetNuke discussions
 
New Post
1/31/2007 2:49 PM
 
Just to clarify Chris's comment, you should not remove the GO but instead add the return.  When you have multiple SQL Statements the GO statement is used as a delimiter to separate each statement for separate execution.

Joe Brinkman
DNN Corp.
 
Previous
 
Next
HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0"Incorrect Syntax near "Incorrect Syntax near 'GO'" in custom sql2k script


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out