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.
Author |
Topic |
Patyk
Yak Posting Veteran
74 Posts |
Posted - 2014-11-06 : 13:57:55
|
thanks |
|
AASC
Starting Member
24 Posts |
Posted - 2014-11-06 : 14:16:19
|
I supposed that only two email lines are per customer---create table to test querycreate table customer ( customer varchar(200), email varchar(20),line int)---insert Dumpy datainsert into customer select 'cust001','abc@.com', 1union select 'cust001','adc@.com',2unionselect 'cust002','fc@.com',1unionselect 'cust003','gbc@.com',1unionselect 'cust003','hbc@.com',2GO--- create view for customer email accountscreate view V_CustomerEmaillinesAS select customer, max(case EmailLine when 1 then email else '' end) emailine1 , max(case EmailLine when 2 then email else '' end) emailine2from(select row_number()over(partition by customer order by line asc) EmailLine,* from customer )cusemailgroup by customerGO---- verify view select * from V_CustomerEmaillines |
|
|
Patyk
Yak Posting Veteran
74 Posts |
Posted - 2014-11-06 : 14:48:37
|
thanks it works fine. I am able to edit this view , open but only when I right click on the view and select design this crushes the server. |
|
|
AASC
Starting Member
24 Posts |
Posted - 2014-11-07 : 10:31:33
|
you can get script of View using tsql commandUse yourDatabaseNameGOsp_helptext 'Your view name' |
|
|
|
|
|
|
|