Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 How to insert a dummy column in the query result?

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2002-10-15 : 08:24:59
Harish writes "Here's a sample of what I am trying to do.

SELECT * FROM CITY
WHERE POPULATION > '2000'

I want to introduce a column, YEAR in the result with a value '2002'.

Any help would be appreciated."

SamC
White Water Yakist

3467 Posts

Posted - 2002-10-15 : 08:31:53
SELECT *, '2002' AS YEAR FROM CITY WHERE POPULATION > '2002'

Sam



Go to Top of Page

Merkin
Funky Drop Bear Fearing SQL Dude!

4970 Posts

Posted - 2002-10-15 : 08:32:37
Hi

Try this :

SELECT * , 2002 AS [YEAR]
FROM CITY
WHERE POPULATION > '2000'



Damian
Go to Top of Page

Merkin
Funky Drop Bear Fearing SQL Dude!

4970 Posts

Posted - 2002-10-15 : 08:33:51
Not bad, only 45 seconds faster

(I'd say sniped, but it's in poor taste )

Damian
Go to Top of Page
   

- Advertisement -