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)
 Views

Author  Topic 

JennyCullen
Starting Member

2 Posts

Posted - 2003-04-14 : 05:31:25
Someone help please

I'm joinging one table to another but I want to manipulate a column in one of the tables.
Can I do this this will creating the view ?

Similarly, Is it possible to add a column to a view while joining two tables together ?

Thanx

Jenny

Peter Dutch
Posting Yak Master

127 Posts

Posted - 2003-04-14 : 07:38:30
http://www.aspmessageboard.com/forum/databases.asp?M=572443&F=21&P=1

Go to Top of Page

mohdowais
Sheikh of Yak Knowledge

1456 Posts

Posted - 2003-04-14 : 09:15:51
Jenny, what do you mean when you say "I want to manipulate a column"? If you mean you want to format it in some way (for example, displaying only part of a string), yes you can. And yes, you can add a column to a view, with a static value or a value based on calculations or other operations on other columns in the base tables used in the view.

OS

Go to Top of Page

JennyCullen
Starting Member

2 Posts

Posted - 2003-04-14 : 20:04:34
Mohdowais,

I don't need to format the column in any way, I just need to set it to zero.
Do you have any sample code of how to do this or how to add a static column ?

Thanx

Jenny

PS. Peter you're a genius.....


Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2003-04-14 : 20:17:37
If you just want one of the columns to be 0, then how about this:

CREATE VIEW v_SomeView
AS
SELECT t1.Column1, t1.Column2, 0 AS Zero, t1.Column4
FROM Table1 t1
INNER JOIN Table2 t2 ON t1.Column1 = t2.Column1
GO

Tara
Go to Top of Page
   

- Advertisement -