November 9, 2006 at 1:05 am
I wrote a SQL script and I fetched a row as a result.I tried this SQL with using "AS" command but it returned the same column again. After I changed the alias name to "adi" which is the name of the row (alias name=row name) at the table and it returned true result.(But this is unnecessary).So I want to ask why it is returning 2 column for the SQL script ?
November 9, 2006 at 1:30 am
Please post your query, some DDL, sample data and expected results. It's much easier for us to solve if you do that than it is if we have to try to visualise what you're doing from a description. Have a look at the following two articles, which are useful to first-time posters: http://www.sqlservercentral.com/columnists/siyer/2645.asp, which contains a link to http://www.aspfaq.com/etiquette.asp?id=5006
By the way, rows don't have names. Did you mean "column"?
John
November 9, 2006 at 2:17 am
"
/* Data */
ALTER PROCEDURE dbo.as_hamm
AS
select adi as 'Adlar' from as_hammadde
/* Requirement */
I used this script. I'm sorry , you are wright I equalized column name and alias name. It returns two columns 'adi' and 'Adlar'. But column 'adi' doesn't have any record. "
November 9, 2006 at 2:50 am
I suspect this might be to do with SET QUOTED IDENTIFIER. Have a look at that topic in Books Online, then try altering your procedure so as to remove the quotation marks, or maybe replace them with square brackets. If that doesn't work, and you want more help from me, you need to provide the DDL for as_hammadde as well as (a sample of) the result set you are getting.
John
November 9, 2006 at 4:13 am
Single quotes are string delimiters in SQL. Try
SELECT adi AS Adlar from
OR
Select adi AS "Adlar" from
Hope that helps
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
November 9, 2006 at 6:24 am
Personally I do
SELECT adi AS [Adlar]
it removes all problems and abiguity
Far away is close at hand in the images of elsewhere.
Anon.
Viewing 6 posts - 1 through 6 (of 6 total)
You must be logged in to reply to this topic. Login to reply