Sorry, poor communication skillz ;)
I was trying to point out that actually it is the EXISTS keyword that
doesn't like being given NText. Rather than selecting out the actual value,
if you keep your origonal WHERE predicates you may simply select 1 (logical
true). The rest of your query may remain the same.
try the following:
IF EXISTS
(
SELECT
1
FROM
table
WHERE
varType = 'siteMenu'
)
UPDATE table SET longVarValue = ? WHERE varType = 'siteMenu'
ELSE
INSERT INTO table (varType, longVarValue) VALUES ('siteMenu', ?)
"Darrel" <no*****@nospam.com> wrote in message
news:u8**************@TK2MSFTNGP02.phx.gbl...
not sure this is the correct group, but you should use 'if select 1 from
xxx where xxxx' as in the code below:
I'm not quite following that. I'm not using a SP, btw. Here's my actual
query I'd like to use:
IF EXISTS (SELECT varType, longVarValue FROM table WHERE varType =
'siteMenu') UPDATE table SET longVarValue = ? WHERE varType = 'siteMenu'
ELSE INSERT INTO table (varType, longVarValue) VALUES ('siteMenu', ?)
With longVarValue being of type 'text' in the DB. Do I need to case that
as 'ntext'?
-Darrel