Adam
Oct 17, 2016 11:23:39 AM

WinSQL Column Alias

Greetings,

I'm running into a syntax issue with column aliases, and I'm hoping someone can point me in the right direction.  I'm using the following syntax for a SELECT statement, and it returns the alias properly.

SELECT FNAME AS FirstName

But when I add a space into it, it errors out.

SELECT FNAME AS First Name

I've tried surrounding it in apostrophes, quotes, and brackets, but none seem to be working for me.

Can anyone help me with the syntax for making column aliases with spaces in them in WinSQL?

 

Thanks,

Adam



Synametrics support engineer
Oct 17, 2016 1:19:13 PM

WinSQL Column Alias

Adam,

The answer to this question depends upon the back-end you are connecting to. WinSQL sends your script as-is to back-end and therefore, the script must conform to SQL dialect supported by the RDBMS. For example, if your connecting to MS SQL Server, you could write something like:

SELECT FName as [First Name]

Check the documentation of your RDBMS for a definitive answer.



Bill48105
Oct 17, 2016 1:25:11 PM

WinSQL Column Alias

Did you try tick symbol vs single quotes?  that's the one that tilts to the left on tilde key ` vs ' which is more verical on " key.
SELECT FNAME AS `First Name`;

Navigation

Social Media

Powered by 10MinutesWeb.com