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

Top 5 Contributors of the Month
Melody Anderson
Post New Web Links

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

Posted By:      Posted Date: October 27, 2010    Points: 0   Category :Sql Server

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)







View Complete Post

More Related Resource Links

Msg 156, Level 15, State 1, Line 2 Incorrect syntax near the keyword 'WHERE'.



Recently received a trace file from customer of sql server which shows some errors in SQL statement but the front-end application is working fine.

I see SET FMTONLY ON and SET FMTONLYOFF and an additional WHERE clause. The statement looks like:


Msg 156, Level 15, State 1, Line 7 Incorrect syntax near the keyword 'FROM'.


I am a student taking SQL classes and am having this error message with this SQL Script:


SELECT c.State, i.itemType,
        Cast(Year(o.orderDate) as Varchar) + N'-' +
        Cast((Month(o.orderDate) -1) / 3 + 1 as Varchar)
            as YearQuarter,
        Round((od.quantity * od.price)*(1-od.discount)
            as Sales
FROM Consumers c, Orders o, OrderLines od, inventory i
WHERE c.ConsumerId = o.ConsumerID and
        od.orderID = o.orderID and
        i.inventoryID = od.inventoryID;


any idea from that on what I am doing wrong? I'm thinking it's something simple.

Msg 102, Level 15, State 1, Line 12 INCORRECT SYNTAX NEAR ')'

CREATE Table Item(
ItemID    numeric(18,2)  PRIMARY KEY,
VendorID   numeric(18,0)  NOT NULL,
ItemDescription  Char(50)   NULL,
PurchaseDate  DateTime   NOT NULL,
ItemCost   numeric(18,2)  NOT NULL,
ItemPrice   numeric(18,2)  NOT NULL,
  REFERENCES Vendor(VendorID)
);      <<<<HERE IS THE ERROR

Msg 102, Level 15, State 1, Line 2 Incorrect syntax near 'MODIFY'





Msg 102, Level 15, State 1, Line 2 Incorrect syntax near 'MODIFY'.


Msg 102, Level 15, State 1, Line 1 ,Incorrect syntax near '='


i am getting the error Msg 102, Level 15, State 1, Line 1 ,Incorrect syntax near '=' when i executing the query :-


into author values(Ano=3,Author='Bannu',Addr='Delhi',Book='Hum-Tum')

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


Index Rebuild failing with sql error msg 8966, level 16, state 2, line 20


Working with a customer trying to help him re-index his database. Database is a little over a terabyte and I gave him a re-indexing script to run on his SQL Server 2005 Enterprise server.

It had been recommended by a 3rd party load testing company that all of our re-indexing be done in "offline" mode so the re-indexing was done in offline mode for this customer.

The first reindex attempt stopped with a "severe" error message in the "query window" when sql reached the largest table in the system, which I found out contains about 29 milliion rows. The previous indexes had been successfully rebuilt or reorganized based on the percentage of fragmentation.

I asked for the sql error logs and found the "severe" error message written to the log around the time of a "sql server restart". I asked the customer and he admitted to restarting sql server. I suspected that the reindex script had not completed but could not be sure.

I decided to approach it next by rebuilding the index on the huge table only. He called me the next day and told me the rebuild had failed. He sent me the error logs and he also informed me he had killed the index query after it had been running for over 24 hours.

I found some IO errors in the sql error logs referring to "15 seconds" had been exceeded a

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.

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:


Msg 50000, Level 16, State 1, Line 34



I get the following error:

Msg 50000, Level 16, State 1, Line 34
An error occurred in the Microsoft .NET Framework while trying to load assembly id 65669. The server may be running out of resources, or the assembly may not be trusted with PERMISSION_SET = EXTERNAL_ACCESS or UNSAFE. Run the query again, or check documentation to see how to solve the assembly trust issues. For more information about this error:
System.IO.FileLoadException: Could not load file or assembly 'capsqlextensions, Version=, Culture=neutral, PublicKeyToken=null' or one of its dependencies. An error relating to security occurred. (Exception from HRESULT: 0x8013150A)
   at System.Reflection.Assembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection)
   at System.Reflection.Assembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection)
   at System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection)
   at System.Reflection.Ass

Bizarre Error. "Message: [Column Name]"


I'm getting a really strange error in my application when under heavy load.  The page(s) pull information from our SQL database and when this error occurs, I don't get a real error message.  Instead, the error information looks like the following:

Message: TimeZoneOffset
Source: System.Data
StackTrace: at System.Data.ProviderBase.FieldNameLookup.GetOrdinal(String fieldName)
at System.Data.SqlClient.SqlDataReader.GetOrdinal(String name)
at System.Data.SqlClient.SqlDataReader.get_Item(String name)
at WebReport_mb_Main.GetTimeZoneDetails() in C:\Projects\WebReport\mb_Main.aspx.cs:line 260
at WebReport_mb_Main.Page_Load(Object sender, EventArgs e) in C:\Projects\WebReport\mb_Main.aspx.cs:line 38
at System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e)
at System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e)
at System.Web.UI.Control.OnLoad(EventArgs e)
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

So what does this mean?  More importantly, how can I fix it?  If no one knows the answer, does anyone have any ideas for what I can do to better search for thi

Msg 10301, Level 16, State 1, Line 1

Hi, I am trying to register Excel that should be located at: C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727 in order to: CREATE ASSEMBLY Excel FROM 'C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Microsoft.Office.Interop.Excel.dll' But there is no: 'C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Microsoft.Office.Interop.Excel.dll' Where could I find that? Regards, Jos

Msg 15121, Level 16, State 10, XP_Cmdshell - A call to 'CreateProcessAsUser' failed with error cod

I have the XP_cmdshell issues for the past two days in SQL2005 SP2 environment. There is a domain account with sysadmin privilege. I have created a proxy account and gave the execute privilege for xp_cmdshell. If i try to run the following commmand EXEC master..xp_cmdshell 'dir *.txt' Msg 15121, Level 16, State 10, Procedure xp_cmdshell, Line 1 An error occurred during the execution of xp_cmdshell. A call to 'CreateProcessAsUser' failed with error code: '1314'. But if i give sysadmin priv and then i try to execute. It worked. I cant give sysadmin priv so i m using a proxy account. Whether any one have solution for it.

Msg 8624, Level 16, State 13 - Internal SQL Server error.

Hi, I have a weird T-SQL 80 query full of nested subqueries full of aggregations tha thas been embedded in a view. if I do select * from the view I get: Server: Msg 8624, Level 16, State 13 Internal SQL Error.  If I run the same block of code from the query analyzer it runs fine. Also if I wrap exactly the same code in a SP it runs fine. I'm running this on a SQL Server 2000 Standard Edition SP4 8.00.2282. + I turned on the following Trace Flags: 3614, 9052, 9054, 9056, 9057, 9185, 9256. If I restore the same DB on a SQL Server 2005 and do the same select * it runs fine. So I'm getting the Error 8624 only on my SQL 2000 Standard edition  SP4 8.00.2282. Another thing I dont understand is also: why I can compile the view but if I try to visualize even the query plan I get the same error?!? Any suggestion will be appreciated. Thank you. Regards, Marco    

SQL failover on 2 different clusters with message: Error: 17189, Severity: 16, State: 1.

SQL: SQL Server 2005 SP2 CU2 64-bit Ent Edition, Active/passive Cluster. Involved in transactional replication both as a subscriber (to about 350 publishers), and a publisher (to 1 subscriber). Distribution runs on seperate servers. Hardware: both nodes are Dell 6850'x 8 cores, 16  BG ram, running on a CX3-80 SAN   Utilization: 24x7 sales website - this is the OLTP DB supporting it.   Server Usage:   CPU typically around 10%-20%. Still getting specific about CPU during the actual failures, but it doesn't spike, and no MOM alerts fired. User Connections: historically was around 500-600, but during this week, some changes made to on the distribution server handling the the 400 publications the server subcribes to, has been changed, and we not have around 250 user connections.   We have had quite a few issues this week - but none before this week.   Changes: Other than a change to the way we are getting the transactional replication data into this server (reducing the number of publishers connecting to the OLTP DB), no *known* system changes - no SQL upgrades, no OS upgrades, no hardware changes/ugrades, no application/DB releases. We have a semi-decent change control system, so while we will chase those areas to ensure nothing unknown happened, they aren't our primary area of suspicion.   What we are seeing is a large amount (several hundred) of the following messages (taken

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

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?

LINQ to SQL "Incorrect syntax near the keyword 'WHERE'"


I am having a problem that creeps up over and over when using LINQ to SQL.  I am getting the error: System.Data.SqlClient.SqlException: Incorrect syntax near the keyword 'WHERE'.

Now I have done a great deal of digging, and the only cause I can seem to find is when users are overriding the Equals() or GetHasCode() methods of the generated classes.  I am not overriding either.  I am getting this error on two different project with two different databases.  I have tried everything every post I have found suggests.  I have even scrapped my dbml file and re-created, all to no avail.

Anyone have any thoughts?  They would be greatly appreciated!

Ryan Sakry
Program Manager
Retail Information Technology Enterprises
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