473,800 Members | 2,602 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

stored procedure update HUGE PROBLEM

Hi,

I need help on this one. For the past two days, whenever I make a
modification to a stored procedure using enterprise manager (Apply),
the stored procedure stops working.

If I copy it under a new name, it works but as soon as I make a
modification, it stops working. I am going crazy on this one.

The error : wrong column name. He doesn't recognize the column name on
a very straighforward line : SELECT @SQL1 = 'SELECT @Total1 = Count(*)
FROM dbo.Tbl_Report WHERE Utilisateur = "'+@utilisateur +'"

For example 'sa' is not a column (it skips Utilisateur as the column
name).

Very strange. Never had this problem in the past. thank you very much.

Nov 8 '05 #1
4 1631
Don´t know which "as" you mean but I would assume to write the
character rather than doublequoting them, that more readable.

SELECT @SQL1 = 'SELECT @Total1 = Count(*) FROM dbo.Tbl_Report WHERE
Utilisateur =' +CHAR(39) +@utilisateur +CHAR(39)

HTH, Jens Suessmeyer.

Nov 8 '05 #2
Don't ever create or alter procs in Enterprise Manager. Use Query
Analyzer and specify SET QUOTED_IDENTIFI ER and ANS_NULLS ON or OFF as
required. Prefereably always ON.

Your code fragment looks wrong anyway. Presumably it should be:

SELECT @SQL1 = 'SELECT @Total1 = Count(*) FROM dbo.Tbl_Report WHERE
Utilisateur = '''+@utilisateu r+''''

Don't use double quotes for string delimiters.

--
David Portas
SQL Server MVP
--

Nov 8 '05 #3
Patrik (pa***********@ umontreal.ca) writes:
I need help on this one. For the past two days, whenever I make a
modification to a stored procedure using enterprise manager (Apply),
the stored procedure stops working.

If I copy it under a new name, it works but as soon as I make a
modification, it stops working. I am going crazy on this one.

The error : wrong column name. He doesn't recognize the column name on
a very straighforward line : SELECT @SQL1 = 'SELECT @Total1 = Count(*)
FROM dbo.Tbl_Report WHERE Utilisateur = "'+@utilisateur +'"

For example 'sa' is not a column (it skips Utilisateur as the column
name).

Very strange. Never had this problem in the past. thank you very much.


The problem is that " sometimes is a string delimiter in T-SQL and
sometimes it is an identifier delimiter. This depends on the setting
QUOTED_IDENTIFI ER. This setting is ON by default in most environment,
and this is also the recommended setting since some functionality
requires this setting to be in effect. It happens to be the case that
EM has this setting off by default, but EM is really a crappy tool for
maintaing stored procedures. Use Query Analyzer instead.

I appreciate that when working with dynamic SQL, it's very nice to
have access to both ' and " as string delimiters. You can put
SET QUOTED_IDENTIFI ER OFF first in you dynamic SQL, and then you can
use " within the dynamic SQL. But that presumes that you are not using
indexed views, so best is probably to stick with ' only - even if
the list of ' can sometimes become unbelievably long.

By the way, there is no need for dynamic SQL in the snippet you posted.
--
Erland Sommarskog, SQL Server MVP, es****@sommarsk og.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinf...2000/books.asp

Nov 8 '05 #4
Thank you both for these clarifications. I will indeed stop using EM
and will read furthermor on quoted_identifi er as I leave it on.

Erland Sommarskog wrote:
Patrik (pa***********@ umontreal.ca) writes:
I need help on this one. For the past two days, whenever I make a
modification to a stored procedure using enterprise manager (Apply),
the stored procedure stops working.

If I copy it under a new name, it works but as soon as I make a
modification, it stops working. I am going crazy on this one.

The error : wrong column name. He doesn't recognize the column name on
a very straighforward line : SELECT @SQL1 = 'SELECT @Total1 = Count(*)
FROM dbo.Tbl_Report WHERE Utilisateur = "'+@utilisateur +'"

For example 'sa' is not a column (it skips Utilisateur as the column
name).

Very strange. Never had this problem in the past. thank you very much.


The problem is that " sometimes is a string delimiter in T-SQL and
sometimes it is an identifier delimiter. This depends on the setting
QUOTED_IDENTIFI ER. This setting is ON by default in most environment,
and this is also the recommended setting since some functionality
requires this setting to be in effect. It happens to be the case that
EM has this setting off by default, but EM is really a crappy tool for
maintaing stored procedures. Use Query Analyzer instead.

I appreciate that when working with dynamic SQL, it's very nice to
have access to both ' and " as string delimiters. You can put
SET QUOTED_IDENTIFI ER OFF first in you dynamic SQL, and then you can
use " within the dynamic SQL. But that presumes that you are not using
indexed views, so best is probably to stick with ' only - even if
the list of ' can sometimes become unbelievably long.

By the way, there is no need for dynamic SQL in the snippet you posted.
--
Erland Sommarskog, SQL Server MVP, es****@sommarsk og.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinf...2000/books.asp


Nov 9 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
4672
by: Samir Pandey | last post by:
I have a table which contains approx 3,00,000 records. I need to import this data into another table by executing a stored procedure. This stored procedure accepts the values from the table as params. My current solution is reading the table in cursor and executing the stored procedure. This takes tooooooo long. approx 5-6 hrs. I need to make it better. Can anyone help ? Samir
4
6235
by: deprins | last post by:
Hello, I have wrote a stored procedure but its real slow. Its activated by a button on web page but its takes to long to process and the web server gives a timeout message after 5 minutes. Is there anyway to speed up this stored procedure? What am I doing wrong here? ------------------------------------------------------------------------------
12
8354
by: serge | last post by:
I have an SP that is big, huge, 700-800 lines. I am not an expert but I need to figure out every possible way that I can improve the performance speed of this SP. In the next couple of weeks I will work on preparing SQL statements that will create the tables, insert sample record and run the SP. I would hope people will look at my SP and give me any hints on how I can better write the SP.
7
3259
by: Alex | last post by:
Hi all, I am trying to install a java stored procedure via the windows development centre. The linux box is running 8.1 FP4 as is the windoze platform. If I am on the linux box i can install the sample jdbc stored procedures o.k. For the purpose of this test I created a sample procedure that executes "select * from department" when conected to the sample database on the linux box.
2
3335
by: Eli | last post by:
Hi all We currently have a strange problem with calling a Stored Procedure (SQL Database) in our C# Project. The only error I get is "System error" which says a lot :) Background: We have several stored procedures to Insert and update datas in our SQL database. Some stored procedures are smaller (insert datas in only one table) and some of them are quite big (insert datas in several
7
2241
by: Peter D.C. | last post by:
Hi I want to update data hold in several textbox controls on an asp.net form. But it seems like it is the old textbox values that is "re-updates" through a stored procedure who updates a SQL tabel. I know the SP works, because a smalldatetime-field in the database is changed. I've tried to disable viewstate on all textbox controls. Any ideas to solve this problem.
7
3471
by: Dabbler | last post by:
I'm using an ObjectDataSource with a stored procedure and am getting the following error when trying to update (ExecuteNonQuery): System.Data.SqlClient.SqlException: Procedure or Function 'UpdateRegistrant' expects parameter '@EMail', which was not supplied. The field value was null in the database and not changed in the FormView so is null going back into the stored procedure. I'm stumped and would greatly appreciate any suggestions.
5
5360
by: wpellett | last post by:
I can not get the SQL compiler to rewrite my SQL UPDATE statement to include columns being SET in a Stored Procedure being called from a BEFORE UPDATE trigger. Example: create table schema1.emp ( fname varchar(15) not null, lname varchar(15) not null, dob date,
9
2470
by: Frawls | last post by:
Hi I Am am having problems with a stored Procedure that i wrote. Basically whats happening is that the Stored procedure Runs fine when i EXECUTE it in SQL Query analyzer. But when i debug through the application in Visual Studio .NET 2003 the application an exception when it executes the query.
0
9691
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9551
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
10255
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10036
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9092
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6815
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5473
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4150
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2948
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.