SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2005 Forums
 Other SQL Server Topics (2005)
 Create Dummy Fileds In View
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

chipembele
Posting Yak Master

106 Posts

Posted - 12/14/2012 :  05:42:43  Show Profile  Reply with Quote
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
Flowing Fount of Yak Knowledge

Germany
8766 Posts

Posted - 12/14/2012 :  05:49:38  Show Profile  Visit webfred's Homepage  Reply with Quote
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 - 12/14/2012 :  06:16:09  Show Profile  Reply with Quote
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
Flowing Fount of Yak Knowledge

Germany
8766 Posts

Posted - 12/14/2012 :  07:03:14  Show Profile  Visit webfred's Homepage  Reply with Quote
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 - 12/14/2012 :  07:07:45  Show Profile  Reply with Quote
Thanks. i'll give it a go. I may be back for some more guidance :)
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.05 seconds. Powered By: Snitz Forums 2000