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 2005 Forums
 Other SQL Server Topics (2005)
 Create Dummy Fileds In View

Author  Topic 

chipembele
Posting Yak Master

106 Posts

Posted - 2012-12-14 : 05:42:43
Hi
We are required to create an export from SQL in a specific excel order/format.

Problem is, some of the fields they require dont exist in our database as we dont hold the data.

Is it possible (like in access where you can create dummy fields e.g. DummyField:"") to force a dummy field in a SQL view?

Any pointers appreciated.
Dan

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2012-12-14 : 05:49:38
A view is a SELECT.
In a SELECT you can do:
select col1, col2, col3, '' as DummyField from ... where ...


Too old to Rock'n'Roll too young to die.
Go to Top of Page

chipembele
Posting Yak Master

106 Posts

Posted - 2012-12-14 : 06:16:09
quote:
Originally posted by webfred

A view is a SELECT.
In a SELECT you can do:
select col1, col2, col3, '' as DummyField from ... where ...


Too old to Rock'n'Roll too young to die.



Hi
What if the fields dont exist at all? What I mean is they arent anywhere in the database to be selected from. I'd be saying select from where but they arent anywhere.

Am I missing the point?
Go to Top of Page

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2012-12-14 : 07:03:14
I will try to make my example more clear

select
col1,
col2,
col3,
'A value that does not exists in any of the tables but I need it in the output.' AS HereComesTheNeededButNotExistingColName
from ...
where ...



Too old to Rock'n'Roll too young to die.
Go to Top of Page

chipembele
Posting Yak Master

106 Posts

Posted - 2012-12-14 : 07:07:45
Thanks. i'll give it a go. I may be back for some more guidance :)
Go to Top of Page
   

- Advertisement -