Drop Table
Support Forum for database administrators and web based access to important newsgroups related to databasesI 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!
Post Follow-up to this messageErich93063 wrote: > 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! > Yes, it can be done, and your query should work. What's the error you're getting?
Post Follow-up to this messageOK, 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
Post Follow-up to this messageHi At a guess you have SET QUOTED_IDENTIFIER ON and you are using double quotes? John "Erich93063" <erich93063@gmail.com> wrote in message news:1135891703.009269.19170@g43g2000cwa.googlegroups.com... > 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 >
Post Follow-up to this message
Show a Printable Version
Email This Page to Someone!
Receive updates to this thread