ExamNotes.net  -  IT certification portal

ForumsCertResearchTop sitesNewslettersFree email
HomeRegister
Exams Notes
Practice exams
Exam games
Questions by email
Online training
Training videos
College degrees
Boot camps
Book store
Links directory
Tell a friend
For webmasters

CompTIA Exam Vouchers
Save money on CompTIA exams
Question of the day
Sign up to receive
interactive practice questions
for MCSE, CompTIA
Cisco and other exams
TestKing
Get MCSE, MCSD, CCNA, CCNP,A+, N+ and many more

* ExamSheets *
Guide for Success!
Actual Questions & Answers
MCSE, MCSD, A+ ,CCNA, CCNP
Oracle 8i, Oracle 9i

Online practice tests

Certification sites

Online university

Online college

Online education

Distance learning

Software forum

Server administration forum

Programming resources






This is interesting: Free IT Magazines | Databases help forum



Microsoft (MCSE, MCSD, MOUS, MCAD) > SQL server exams > Sp

Show a Printable Version
Email This Page to Someone!
Receive updates to this thread




Click here for list of SQL 2000 study guides



Author Sp
cocolocopolo
Senior Member




Registered: Apr 2001
Location: Los Angeles
Country: USA
State:
Certifications: A+, Network+, CCNA
Working on: MCDBA

Total Posts: 287
Sp

When I followed the instruction from "MCSE SQL Server 2000 Database Design/Implementation Training Kit" page 314, it shows:

-- Use @r_Code to hold the result code.
Declare @y_YtdSales int, @t_TitleText varchar(80), @r_Code int

-- Run the procedure and set @r_Code equal to the procedure.
Exec @r_Code = SalesForTitle
@YtdSales = @y_YtdSales Output,
@TitleTExt = @t_TitleText Output,
@Title = "%Garlic%"

--Determine the value of @r_Code and execute the code.
If @r_Code = 0
Select "Title" = @t_TitleText,
"Number of Sales" = @y_YtdSales, "Return Code" = @r_Code

Else If @r_Code = 1
Print "No matching titles in the database. Return code=" +
Convert(varchar(1),@r_Code)
Go

Execute the code and will return the following result set:

Title: Onions, Leeks, and Garlic: Cooing Screts ...
No. of Sales 375
Return Code 0


But, actually when I executed this code, I only got error:

Server: Msg 128, Level 15, State 1, Line 16
The name 'No matching titles in the database. Return code=' is not
permitted in this context. Only constants, expressions, or variables allowed here. Column names are not permitted.

Please help find out where I made mistake.

Thanks.

__________________
cocolocopolo

Report this post to a moderator

Old Post 06-28-02 05:15 PM
cocolocopolo is offline Click Here to See the Profile for cocolocopolo Click here to Send cocolocopolo a Private Message Add cocolocopolo to your buddy list Find more posts by cocolocopolo Reply w/Quote Edit/Delete Message IP: Logged
kingsunl
Junior Member
M




Registered: Nov 2001
Location: Richmond
Country: Canada
State:
Certifications: MCSD
Working on: MCSD .NET

Total Posts: 8
Check QUOTED_IDENTIFIER option

Do you have QUOTED_IDENTIFIER set to OFF?

When QUOTED_IDENTIFIER is set to ON, double quotation marks delimit an identifier, such as a column name. That seems to be the cause of your problem.

If QUOTED_IDENTIFIER is set to OFF, "stirng here" is interpreted as a constant string, else it is iterpreted as a column name.

Report this post to a moderator

Old Post 06-28-02 10:30 PM
kingsunl is offline Click Here to See the Profile for kingsunl Click here to Send kingsunl a Private Message Add kingsunl to your buddy list Find more posts by kingsunl Reply w/Quote Edit/Delete Message IP: Logged
kingsunl
Junior Member
M




Registered: Nov 2001
Location: Richmond
Country: Canada
State:
Certifications: MCSD
Working on: MCSD .NET

Total Posts: 8
Use single quote instead

Unless you have good reasons to do so, use single quotes for string rather than change the default QUOTED IDENTIFIER OFF option. If within the string there is an apostrophe, use two single quotes within the string. SQL Server will interpret that as a single apostrophe.

Report this post to a moderator

Old Post 06-29-02 11:42 PM
kingsunl is offline Click Here to See the Profile for kingsunl Click here to Send kingsunl a Private Message Add kingsunl to your buddy list Find more posts by kingsunl Reply w/Quote Edit/Delete Message IP: Logged
cocolocopolo
Senior Member




Registered: Apr 2001
Location: Los Angeles
Country: USA
State:
Certifications: A+, Network+, CCNA
Working on: MCDBA

Total Posts: 287

Thanks kingsunl. It works when I change double quote to single quote.

By the way, where I can turn on/off
QUOTED_IDENTIFIER ???

__________________
cocolocopolo

Report this post to a moderator

Old Post 06-30-02 03:56 AM
cocolocopolo is offline Click Here to See the Profile for cocolocopolo Click here to Send cocolocopolo a Private Message Add cocolocopolo to your buddy list Find more posts by cocolocopolo Reply w/Quote Edit/Delete Message IP: Logged
J-Ho
Member




Registered: Mar 2002
Location:
Country: Ireland
State:
Certifications: MCDBA, MCSD, MCSA, MCSE
Working on: MCAD

Total Posts: 85

quote:
Originally posted by cocolocopolo
By the way, where I can turn on/off
QUOTED_IDENTIFIER ???



Thru SQL. Use the following SQL Statements to turn it on and off:

set quoted_identifier on
set quoted_identifier off

Note, in a batch you need to separate the "set" statements with "go".

Here's a 'steps to repro':
1) Open Enterprise Manger, expand any database, and drill down 'til you see the list of stored procedures in the details pane
2) Select any (or all) stored procedure in the details pane, and press Ctrl+C for 'Copy'
3) Open Notepad or ISQLW
4) Paste in Notepad or ISQLW

You see how the query batch starts of with:

SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO

Report this post to a moderator

Old Post 06-30-02 07:37 PM
J-Ho is offline Click Here to See the Profile for J-Ho Click here to Send J-Ho a Private Message Add J-Ho to your buddy list Find more posts by J-Ho Reply w/Quote Edit/Delete Message IP: Logged
kingsunl
Junior Member
M




Registered: Nov 2001
Location: Richmond
Country: Canada
State:
Certifications: MCSD
Working on: MCSD .NET

Total Posts: 8

quote:

By the way, where I can turn on/off
QUOTED_IDENTIFIER ???

In Enterprise Manager, highlight the database you want to set the options, right click to bring up the menu and choose Properties. From the database properties dialog box, click on the Options tab. Check or uncheck the database settings.

Report this post to a moderator

Old Post 07-02-02 09:59 PM
kingsunl is offline Click Here to See the Profile for kingsunl Click here to Send kingsunl a Private Message Add kingsunl to your buddy list Find more posts by kingsunl Reply w/Quote Edit/Delete Message IP: Logged
cocolocopolo
Senior Member




Registered: Apr 2001
Location: Los Angeles
Country: USA
State:
Certifications: A+, Network+, CCNA
Working on: MCDBA

Total Posts: 287

Thanks J-Ho and kingsunl (in alphabetical order).

__________________
cocolocopolo

Report this post to a moderator

Old Post 07-03-02 04:44 AM
cocolocopolo is offline Click Here to See the Profile for cocolocopolo Click here to Send cocolocopolo a Private Message Add cocolocopolo to your buddy list Find more posts by cocolocopolo Reply w/Quote Edit/Delete Message IP: Logged
limsam
Senior Member




Registered: Jul 2001
Location:
Country: Australia
State:
Certifications: MCSE (W2K & NT4), CNE5, MCDBA, CCNA
Working on: I am tired!

Total Posts: 572

In Enterprise Manager, highlight the database you want to set the options, right click to bring up the menu and choose Properties. From the database properties dialog box, click on the Options tab. Check or uncheck the database settings

May I add that, if you are running SQL server and the Query analyser on the same PC, setting this option OFF using EM does not have any effect on "Query analyser" since ODBC or Microsoft® OLE DB Provider automatically use SET QUOTED_IDENTIFIER ON.

The following is from BOL.

Quoted identifiers are valid only when the QUOTED_IDENTIFIER option is set to ON. By default, the Microsoft OLE DB Provider for SQL Server and SQL Server ODBC driver set QUOTED_IDENTIFIER ON when they connect. DB-Library does not set QUOTED_IDENTIFIER ON by default

So, unless you are using the DB-Library to connect to the SQL server, the setting on Ent manager is not 'felt'

__________________
Sadly, it is not what you know. It is who you know!

Last edited by limsam on 07-03-02 at 04:54 AM

Report this post to a moderator

Old Post 07-03-02 04:45 AM
limsam is offline Click Here to See the Profile for limsam Click here to Send limsam a Private Message Add limsam to your buddy list Find more posts by limsam Reply w/Quote Edit/Delete Message IP: Logged
cocolocopolo
Senior Member




Registered: Apr 2001
Location: Los Angeles
Country: USA
State:
Certifications: A+, Network+, CCNA
Working on: MCDBA

Total Posts: 287

Thanks limsam. I got one more idea now.

__________________
cocolocopolo

Report this post to a moderator

Old Post 07-05-02 07:12 AM
cocolocopolo is offline Click Here to See the Profile for cocolocopolo Click here to Send cocolocopolo a Private Message Add cocolocopolo to your buddy list Find more posts by cocolocopolo Reply w/Quote Edit/Delete Message IP: Logged
All times are GMT.
Post new thread   Post reply

MCSE exam notes



Forum Jump:
Rate This Thread:
Forum Rules:
Who Can Read The Forum? Any registered user or guest.
Who Can Post New Topics? Any registered user.
Who Can Post Replies? Any registered user.
Changes: Messages can be edited by their author.
Posts: HTML code is OFF. Smilies are ON. vB code is ON. [IMG] code is ON.
 

ExamNotes forum archive


Powered by: vBulletin 2.2.8
Copyright ©2000, Jelsoft Enterprises Limited.

  Free Braindumps | mcse braindumps