.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

EXEC 17P_Comose will give incorrect syntax error. Because of numeric name

Posted By:      Posted Date: September 15, 2010    Points: 0   Category :ASP.Net
I am working with a sql server database with about 50 stored procedures. The database and stored procedureswere not created by me. The stored procedures all begin with a number in their name. Example: 17P_Comsetter The problem I am having is that if I try and execute the stored procedure at the command line in Query Analyzer,the query analyzer appears not to like that the stored procedure begins with a number. For example: If I try an run the stored procedure as follows: EXEC 17P_Comsetter Then I get the following error message:Msg 102, ..... Incorrect Syntax near '17' If I rename the stored procedure so that it does not begin with a number, then I do not get the error. The problemis that the company I am working at has a policy in place that stored procs must begin with a number.I am using SQL server 2005. Does anyone know why I am getting this error message?

View Complete Post

More Related Resource Links

Incorrect syntax near 'GO' error while running a sql script ?


I am using Visual Studio 2008

I have one Database A

now i want to create Database B just like Database A

I generated a script of Database A

and created fresh Database B

Now, when i try to run the generated script against Database B, i get this error, why ? how to fix it ?

sql error

For your information:

I have checked in my script it is:


and i have also tried to save the sql script in notepad as: ANSI, UTF-8 and UNICODE

and then i copied from txt file to query but still doesn't work and getting the same error

and these are the option that i selected/used while creating my script:


Receiving error message: Incorrect syntax near 'au'.

"SELECT am.State,au.Email,am.Phone,au.UserId,au.Name FROM table1 au INNER JOIN table2 am on au.UserId = am.UserId" 

"UPDATE table1 au INNER JOIN table2 am on au.UserId = am.UserId SET am.State = @State,au.Email = @Email,am.Phone = @Phone,au.UserId = @UserId,au.Name = @Name"


Might someone be able to tell me what may be causing the above error message in one or both of the above statements?

Many thanks


Another ERROR Message Msg 156, Level 15, State 1, Line 2 Incorrect syntax near the keyword 'COLUMN'


Ok, I would like to ask you this if I may,

On another database I created a table named FICTION

and the table looks like this:


Now I am trying to change the data type in TITLE to CHAR(50)







exec syntax error?


hey guys, does anyone know why am i getting error at the last line of this statement?:

create trigger StaffUpdateTrigger on Staff after update as

declare @datetime datetime set @datetime=getutcdate()

declare @q nvarchar(max)set @q='insert StaffUpdate('

declare @q2 nvarchar(max)set @q2=')select '

if update(PId)begin 

set @q=@q+'PId,'

set @q2=@q2+(select PId from inserted)


set @q = substring(@q, 1, len(@q)-1)

set @q2 = substring(@q2, 1, len(@q2-1)+' from inserted'


i tried this and it works:

declare @q nvarchar(max)set @q='select*from staff'

declare @q2 nvarchar(max)set @q2=''



Getting an "Incorrect syntax near 'smallint'" error


I'm getting an error that has me stumped.  I suspect the problem is that I've defined a few tables with columns names that have embedded spaces, something that SQL Server allows, but I'm seriously wondering if ASP.NET WebForms has a problem with embedded spaces in column names.  Anyway, I've got a SqlDataSource control on a page with a details view control, which allows for inserting and editing of the table.  Here's the table's definition:

CREATE TABLE [dbo].[Type of Show](
	[Show Code] [smallint] NOT NULL,
	[Show Name] [nvarchar](50) NOT NULL,
	[Image For Show] [nvarchar](255) NULL,
	[Show Code] ASC

 The ASP.NET code defining the SqlDataSource is as follows:

<asp:SqlDataSource ID="sdsTypeOfShow" runat="server" 
	ConnectionString="<%$ ConnectionStrings:VideoLibraryConnectionString %>" 
	DeleteCommand="DELETE FROM [Type of Show] WHERE [Show Code] = @Show_Code" 
	InsertCommand="INSERT INTO [Type of Show] ([Show Code], [Show Name], [Image For Show]) VALUES (@Show_Code, @Show_Name, @Im

"Incorrect document syntax" error when using SQLXML 3.0 Bulkload


I was trying to upload an XML file into MS SQL Server 2000 DB using SQLXML 3.0 Bulkload functionality. However, there was an error says "Incorrect document syntax". I found out it was because my file started with:

<?xml version="1.0" encoding="UTF-8"?>
<CDR version="14.2">

If I remove the second line "<!DOCTYPE CDR>", everthing works fine. However, this file is generated by a third part system and I plan to upload it automatically. Sue I can remove the second line before loading the data. But I am wondering, is there a way of bypass this validation issue in SQLXML?

Can anybody help me here? Thanks in advance.


Incorrect syntax near 'Ident' error



I am getting this when one table is being replicated:

Error messages:
Incorrect syntax near 'Ident'.

The merge process was unable to deliver the snapshot to the Subscriber. If using Web synchronization, the merge process may have been unable to create or write to the message file. When troubleshooting, restart the synchronization with verbose history logging and specify an output file to which to write. (Source: MSSQL_REPL, Error number: MSSQL_REPL-2147201001)

override error message (The value 'test' is not valid for Age) when input incorrect data type for in


Hello everyone,

I've tried to override error message when input incorrect data type in input field on HTML form. For example I have the model like this.

public class Person
public string FirstName {get;set;}
public int Age {get;set;}


For view, I put text input for Age to get it value.

When type some string in Age text box like 'test' and press submit button. I got this error message

The value 'xxx' is not valid for Age

However, I want to change this message and try many way. There 's nothing effect this message value.

Please could you help me to solve this problem.

Error converting data type varchar to numeric.


I create a form to record data using ASP.NET and SQL database...
when i run the project show error "Error converting data type varchar to numeric"

what's the problem actually.i try to change in datatype in database..
but still showing error...


Syntax error (missing operator) in query expression

Good Day Gurus!

I have a Excel user application which has a user form (named 'Registo') that displays criteria and an image that has been entered in it's corresponding spreadsheet. This works the way it should.  There's also the ability to search the spreadsheet via a form (by clicking 'Pesquisar' button) this opens a search form. However, I having a bit of a problem with it. When I try to search for something it basically doesn't do anything at all. It just sits there. So I tried to debug it and I think I'm having a problem with either the JET db engine or somethign with teh query or maybe I don't have the correct reference.

I 'borrowed' this Excel application from another forum because it's exactly what I'm looking for! However, I suck at vb.

So I was hoping somebody could take a look at the code and see if I'm missing something?  I'm kinda' desparate to get this working because I'm been trying to figure it out for days and I'm running out of time.  Cry
Option Explicit

'constantes para auxiliar na verificação do código
Private Const Ascendente As Byte = 0

DataFormWebpart give me an Error



i'm trying to create a dataFormWebpart for my wss3 site.

here are my steps a took:

1. open my site in sharepointdesinger

2. create a new document (just a blank page, i did not use a sharepoint content)

4. create my datasource (my datasource as a view table i created in sql server 2005. can i use a view table to insert and delete data?)

5. select my data

6.insert new item form

then i browse the page. when i insert some data it gives me this error:

"The data source control failed to execute the insert command."

i looked up on the internet and i see the are talking about the

does this update realy fix the issue?

and i'm using sharepoint services sp2 can i use this opdate for a sp2?

or is there another thing that cause this error?



infrastructure Update for Windows SharePoint Services 3.0 (KB951695).

Incorrect syntax near "("


Hi, below is a sub I wrote to run an SQLDataSource UpdateCommand. This is customized layer of a createUserWizard. I know I should probably have another table for the addt'l data and just FK the UserId...but I'd rather update the existing record and add the data to the existing row in the user (membership) table.

Can someone tell me what I'm doing wrong on this sub. The error is at the last line, "DataSource.Update()"


 Protected Sub CreateUserWizard1_CreatedUser(ByVal sender As Object, ByVal e As EventArgs)
        FormsAuthentication.SetAuthCookie(CreateUserWizard1.UserName, False)

        Dim UserNameTextBox As TextBox = DirectCast(CreateUserWizardStep2.ContentTemplateContainer.FindControl("UserName"), TextBox)
        Dim DataSource As SqlDataSource = DirectCast(CreateUserWizardStep2.ContentTemplateContainer.FindControl("InsertExtraInfo"), SqlDataSource)

        Dim User As MembershipUser = Membership.GetUser(UserNameTextBox.Text)
        Dim UserGUID As Object = User.ProviderUserKey

        DataSource.UpdateParameters.Add("UserId", UserGUID.ToString())

End Sub



syntax error in calling mailhelper class??


I use to program with VB.NEt. I am just learning C#.  I need to learn C# b/c I am a SharePoint developer and Admin and thats what SharePoint is coded from.


so I am trying to create a simple form that sends an email but am getting an error with calling this function:

       mailHelper.SendMailMessage("admin@pointeightpower.com", "jstevens@pointeightpower.com", null, null, "August Heat Stress", String.Concat(txtSupervisorName.Text.Trim, "reviewed this month's training on ", System.DateTime.Now));


it says param string has some invalid arguements. I dont know why. it works in VB.Net. any help? Thanks

Incorrect syntax near '<'

It was suggested that I use xmldocument.load to do a sql insert statement instead of BULK INSERT.  However when I run the Sub I am getting this error:  "Incorrect syntax near '<'.   "Here is my code, I have no clue what is causing this error, or how to fix it. Sub AO() Dim Z As String = Microsoft.VisualBasic.Format(Today.AddDays(-1), "MMddyyyy") Dim AO_Name As New String("\\Net\Import\AO-M_" & (Z) & ".xml") Console.WriteLine(AO_Name) Dim AOSQL As String Dim conn As New SqlConnection("Server=DEB\DEVDB;Database=MTrans;User Id=******;Password=**************************;") Dim cmd As New SqlCommand Dim x as New XMLDocument x.Load(AO_Namme) Dim xx As String xx=x.OuterXml AOSQL = "DECLARE @xml XML" + Environment.NewLine() + _ "SELECT @xml = " + xx + _ "Insert into AO (ASSET_OWNER_NAME,SCHEDULED_DATE,SETTLEMENT_CODE, INVOICE, OPERATING_DATE, DA_ADMIN, DA_ASM_REG, DA_ASM_SPIN)" + Environment.NewLine() + _ "SELECT ASSET_OWNER_NAME,SCHEDULED_DATE,CAST(SETTLEMENT_CODE AS smallint) AS SETTLEMENT_CODE, INVOICE, OPERATING_DATE, DA_ADMIN, DA_ASM_REG, DA_ASM_SPIN" + Environment.NewLine() + _ "FROM " + Environment.NewLine() + _ "(SELECT " + Environment.NewLine() + _ "summary.x.value('NAME[1]', 'VARCHAR(10)') AS ASSET_OWNER_NAME,summary.x.value('SCHEDULED_DAT

Data Source View Gives incorrect Error--Different Data Type

Hi, I'm creating a report model (2008 R2).  I am trying to create a relationship between two tables.  One FKs to another--same name and type (tinyint) columns.  But the Data Source View editor doesn't allow this, giving the message "...source and destination column have different data types".  But the columns are the same types.  I ahd this once before  acouple of years ago and don't remember how I got around it. Does anyong have ideas?  

Strange Problem - SSIS Fails with "Syntax error, permission violation, or other nonspecific error".

Hello, I have a strange issue while I am deploying a package to one of the environment server. I have 2 XML Source, in the DataFlow, and one will extracted based on a value of variable that is passed from run time (package is executed from a Job) and other will be extracted all time. The next Step I have is a Execute SQL Task in ControlFlow wihich will execute after DataFlow. This has 2 input parameters and some SQL query that uses the param. Now this one fail on the target environment with below error: failed with the following error: "Syntax error, permission violation, or other nonspecific error". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly. I got the error when I did a SSIS Text File Log. Note: If I run the package in BIDS with the same XML files it work. Also when I deploy the package to my Dev Server it works. When I compare the Dev DB with the target environment DB - Both are same. The Service Acount has permission - as I can see the DataFlow task completed. Another Point: The XML Load Data Flow that executes based on the Variable Value does not execute on target environment, even if the value is passed as "True" (It is Boolean Type) But this variable is NOT an input for the Execute SQL task that fails. I am not sure w

set Alternate language(s) in sharepoint foundation 2010 give error

Hi every one,               i have install Language Packs for SharePoint Foundation 2010  from this link http://www.microsoft.com/downloads/details.aspx?FamilyID=0956787E-210D-4D78-9E4E-A9CDEF0E8495&amp;displaylang=es&displaylang=en this exe, SPLP\14.0.4536.1000_SharePointLanguagePack_none_ship_x64_de-de_exe\SharePointLanguagePack.exe  when i set alternate laguage, that this give error. Runtime Error Description: An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed. Details: To enable the details of this specific error message to be viewable on the local server machine, please create a <customErrors> tag within a "web.config" configuration file located in the root directory of the current web application. This <customErrors> tag should then have its "mode" attribute set to "RemoteOnly". To enable the details to be viewable on remote machines, please set "mode" to "Off". <!-- Web.Config Configuration File --> <configuration> <system.web> <customErrors mode="RemoteOnly"/> </system.web> </configuration> Notes: The current error page you are seeing can be replace
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend