MS SQL Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsDatabasesMS SQL Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old September 2nd, 2008, 05:45 AM
amstel_za amstel_za is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2004
Posts: 277 amstel_za User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 Days 15 h 58 m 37 sec
Reputation Power: 6
MSSQL Query contains single quotes

Hi all,

Now I need a little bit of patience here before I get told to post in the PHP forum I have already posted a similar query but thought I'd cover my bases (from a MSSQL point of view) by posting a question here:

I am sending (via PHP MSSQL_QUERY) the following string:

Use emeagolf

declare @fix varchar(255)
declare @f TABLE (f CHAR(4))

INSERT @f (f) Select CAST(Fixture_ID AS CHAR(4)) From Results Where COmpetitionType_ID = 1 Group By Fixture_ID

SELECT @fix = COALESCE(@fix + ',[', '[') + f + ']' FROM @f

Exec('SELECT * FROM (SELECT TOP 100 PERCENT SUM(r.Score) as Skore, pp.Name, Fixture_ID
FROM dbo.Results AS r INNER JOIN
dbo.Player AS pp ON pp.Player_ID = r.Player_ID
WHERE (r.CompetitionType_ID = 1)
GROUP BY r.Player_ID, pp.Name, Fixture_ID
ORDER BY Skore DESC) AS TT
PIVOT
(
SUM(Skore)
FOR [Fixture_ID] IN ('+@fix+')

) As p')

I need to know, because I don't , whether SQL Server accepting a string (identical above) would have any issues with the ' ? I have already run this query in SQL Server and I know it works...but...when posted from PHP and going to SQL Server I'm wondering whether there is any SQL Server config settings that escape, remove, don't allow single quotations marks.

The error seems to be at the first quotation mark in the COALESCE function - but what I would like to know is if SQL Server treats incoming sql queries differently (either a port setting, an internal option, etc) to when using studio manager application? I usually find SQL Server forgiving when sending queries to it, but not this time

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesMS SQL Development > MSSQL Query contains single quotes


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump



 Free IT White Papers!
 
How to Present Effectively Online
This white paper offers practical and actionable advice on the key steps that any presenter should consider as they plan and execute a Webinar or online meeting.

 
Open Source Security Myths
Open Source Software (OSS) is computer software whose source code is available to the general public with relaxed or non-existent intellectual property restrictions (or arrangement such as the public domain), and is usually developed with the input of many contributors.

 
Power and Cooling Capacity Management for Data Centers
This paper describes the principles for achieving power and cooling capacity management.

 
Scalable, Fault-Tolerant NAS for Oracle - The Next Generation
For several years NAS has been evolving as a storage alternative for Oracle databases, and for good reason: NAS is quite often the simplest, most cost-effective storage approach for Oracle. Learn about the benefits that HP's approach to scalable NAS brings to Oracle environments in this comprehensive white paper.

 
Understanding Web Application Security Challenges
This white paper discusses many common threats and preventive measures for Web application security, and explains what you can do to help protect your organization.

 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2009 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway
Stay green...Green IT