all groups > sql server (alternate) > december 2005 >
You're in the

sql server (alternate)

group:

Simple SQl question


Simple SQl question Erich93063
12/29/2005 12:12:26 PM
sql server (alternate): I am trying to create a SQL statement that returns values from fields
in the database but I also need to return values that are NOT in the
database but hard coded int he SQL statement. The values along with the
names of the fields will be hardcoded into the SQL statement. I'm not
sure if this can be done.

It will be something like this:

SELECT vchrFirstName,
vchrLastName,
'hardcoded value' AS myField
FROM tblCustomer

The above statement does NOT work. It throws an error, but that is what
I am trying to do. Bascially I want the query to return the values for
vchrFirstName and vchrLastName which are in the database, but I also
want the field called "myField" to be returned in the recordset with
the value of "hardcoded value" for every record returned. I hope this
made sense and can be done. THANKS!
Re: Simple SQl question Erich93063
12/29/2005 1:28:23 PM
OK, I must have been doing somethign else wrong, because now it's
working. It's working the way I did it in my post. Not sure what I did
wring before. hmmm THANKS
Re: Simple SQl question Rob
12/29/2005 8:20:22 PM
[quoted text, click to view]

Yes, it can be done, and your query should work. What's the error
Re: Simple SQl question John Bell
12/29/2005 10:01:49 PM
Hi

At a guess you have SET QUOTED_IDENTIFIER ON and you are using double
quotes?

John

[quoted text, click to view]

AddThis Social Bookmark Button