Re: Simple SQl question



Erich93063 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?
.




Relevant Pages

  • Re: ADO data control
    ... Another way to test your query would be to try ... instinctively think that the database is probably not normalized. ... written on the topic of normalization, and one you might like is "Database ... Then the SQL statement and the existing WHERE and ORDER BY calculations ...
    (microsoft.public.vb.controls)
  • RE: FK Constraint Raised for no reason I can find?
    ... the constraints won't be copied to the destination database. ... But you could modify the sql statement for creating the table in the ... SQL Statement window above. ... Microsoft Online Community Support ...
    (microsoft.public.dotnet.framework.windowsforms.controls)
  • RE: FK Constraint Raised for no reason I can find?
    ... the constraints won't be copied to the destination database. ... But you could modify the sql statement for creating the table in the ... SQL Statement window above. ... Microsoft Online Community Support ...
    (microsoft.public.dotnet.framework.windowsforms.controls)
  • Re: Access having run time errors while selecting from odbc linked table
    ... Ok Frank, here ya go: ... Date and Load are variables that are collected by an input box so the sql statement can be dynamic in nature. ... >> Dim con As Object ... >> The exact same code sequence is used in the Database to select items from ...
    (microsoft.public.data.odbc)
  • Re: "Select" & "Order By" OK- WHERE Doesnt Work !
    ... some unspecified database system. ... add error capture code )') to your connect, ... show us the actual code including the echoed sql statement and error ... Tom Thackrey www.creative-light.com tom creative light com do NOT send email to jamesbutler@willglen.net ...
    (comp.lang.php)