By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,570 Members | 999 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,570 IT Pros & Developers. It's quick & easy.

Unique Identifiers & Select Queries to MSSQL in PHP

P: 2
Help.

This has been bugging me for a couple of days now:

I am writing a script to regularly transfer data from a MYSQL db to a MSSQL.

Being new to MSSQL I'm a bit freaked out about the UNIQUEIDENTIFER (UI) system.

I have to INSERT data to a table where I need the UI for items from 2 other tables. This negates my ability to use a JOIN. So I need to grab the UI from within PHP and the reference the variable in the query.

To test this I am using a simple SELECT:

First I need to get the UI:
SELECT CAST(CATALOGGUID as VARCHAR(36)) as CGUID FROM CATALOG WHERE CATALOGNAME='TESTCATALOG'

I then assign CGUID to $CGUID

The problem query is now:
SELECT * FROM CATALOG WHERE CATALOGGUID = '".$CGUID."';

I have tried wrapping the string with curly brackets { & }. But it won't work.

I copy the query and put it into SQL QUERY ANALYZER then it works perfectly. The problem is just from inside PHP.

Has anybody else had this problem? or knows of a solution?

The server OS is Windows 2003 Server. PHP is 5+.


Thanx in advance...
Oct 11 '06 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.