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
 General SQL Server Forums
 New to SQL Server Programming
 Selecting columns and a set text, how to?

Author  Topic 

Eagle_f90
Constraint Violating Yak Guru

424 Posts

Posted - 2012-06-13 : 20:10:03
[code]select SectionID as ID, SectionTitle as Title, 'AddSection.aspx' as PageName from dbo.SectionInfo[/code]
I currently have the above code where I am selecting differant columns from a table but at the end of each row I want to also pass the static text "AddSection.aspx" so that when the select statment runs it returns an output like

[code]
ID Title PageName
1 GameTitle AddSection.aspx
2 Game2 AddSection.aspx[/code]

I know my code is wrong but how do I make it correct?

--
If I get used to envying others...
Those things about my self I pride will slowly fade away.
-Stellvia

shilpash
Posting Yak Master

103 Posts

Posted - 2012-06-13 : 20:51:06
update SectionInfo
set pagename='AddSection.aspx'

select SectionID as ID, SectionTitle as Title, PageName from dbo.SectionInfo
Go to Top of Page

Eagle_f90
Constraint Violating Yak Guru

424 Posts

Posted - 2012-06-13 : 21:35:14
quote:
Originally posted by shilpash

update SectionInfo
set pagename='AddSection.aspx'

select SectionID as ID, SectionTitle as Title, PageName from dbo.SectionInfo


The DB does not contain a column called PageName

--
If I get used to envying others...
Those things about my self I pride will slowly fade away.
-Stellvia
Go to Top of Page

Eagle_f90
Constraint Violating Yak Guru

424 Posts

Posted - 2012-06-13 : 21:51:34
I figured it out

select SectionID as ID, SectionTitle as Title, CAST('AddSection.aspx' as char(15)) as PageName from dbo.SectionInfo

--
If I get used to envying others...
Those things about my self I pride will slowly fade away.
-Stellvia
Go to Top of Page
   

- Advertisement -