Author |
Topic |
cutiebo2t
Constraint Violating Yak Guru
256 Posts |
Posted - 2010-01-31 : 21:09:54
|
Table Name = MedMedmed1, med3, med5I want to create a view that would be viewed like this:Medmed1med3med5Any help is appreciated. Thanks |
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2010-01-31 : 21:12:10
|
use one of the followingCSVTablefnParseList KH[spoiler]Time is always against us[/spoiler] |
|
|
cutiebo2t
Constraint Violating Yak Guru
256 Posts |
Posted - 2010-01-31 : 21:32:28
|
is it possible without creating a stored procedure? |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2010-01-31 : 22:01:09
|
those are function not stored procedure KH[spoiler]Time is always against us[/spoiler] |
|
|
cutiebo2t
Constraint Violating Yak Guru
256 Posts |
Posted - 2010-01-31 : 22:02:18
|
i really don't understand how. |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2010-01-31 : 22:10:39
|
[code]begin tran-- Create a table for testing and for illustration of the functioncreate table Med( csvmed varchar(20))-- Insert some sample data into the testing tableinsert into Med (csvmed)select 'med1, med2, med3' union allselect 'med4, med5, med6'-- the Query. Which you can convert into a View easily select stringval as medfrom Med m cross apply dbo.CSVTable(csvmed)rollback[/code] KH[spoiler]Time is always against us[/spoiler] |
|
|
cutiebo2t
Constraint Violating Yak Guru
256 Posts |
Posted - 2010-01-31 : 22:14:37
|
am getting this error:Line 3: Incorrect syntax near 'apply'. |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2010-01-31 : 22:16:28
|
what is the version of your SQL Server ? KH[spoiler]Time is always against us[/spoiler] |
|
|
cutiebo2t
Constraint Violating Yak Guru
256 Posts |
Posted - 2010-01-31 : 22:16:58
|
2000 sir |
|
|
cutiebo2t
Constraint Violating Yak Guru
256 Posts |
Posted - 2010-01-31 : 22:25:14
|
I got the error when I tried running this script:select stringval as medfrom Med m cross apply dbo.CSVTable(csvmed) |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2010-01-31 : 22:28:57
|
CROSS APPLY is only available for SQL 2005/2008 KH[spoiler]Time is always against us[/spoiler] |
|
|
cutiebo2t
Constraint Violating Yak Guru
256 Posts |
Posted - 2010-01-31 : 22:30:17
|
any option for 2000? :( |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2010-01-31 : 22:30:21
|
for 2000, it will not be easy. What are you trying to achieve here ? KH[spoiler]Time is always against us[/spoiler] |
|
|
cutiebo2t
Constraint Violating Yak Guru
256 Posts |
Posted - 2010-01-31 : 22:32:24
|
i would like to have results that would like like this:MEDmed1med2med3med4med5 med6 |
|
|
cutiebo2t
Constraint Violating Yak Guru
256 Posts |
Posted - 2010-01-31 : 22:47:52
|
Hi I tried it in 2005 but I got this message:Invalid object name 'dbo.CSVTable'. |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2010-01-31 : 23:38:03
|
quote: Originally posted by cutiebo2t Hi I tried it in 2005 but I got this message:Invalid object name 'dbo.CSVTable'.
see my 1st post. Get it from the link KH[spoiler]Time is always against us[/spoiler] |
|
|
cutiebo2t
Constraint Violating Yak Guru
256 Posts |
Posted - 2010-02-01 : 01:10:41
|
I got it. What if I want it in a horizontal view. Like this:med1 med2 med3 med4 med5 med6 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2010-02-01 : 01:16:20
|
quote: Originally posted by cutiebo2t I got it. What if I want it in a horizontal view. Like this:med1 med2 med3 med4 med5 med6
Where do you want to show the data?MadhivananFailing to plan is Planning to fail |
|
|
cutiebo2t
Constraint Violating Yak Guru
256 Posts |
Posted - 2010-02-01 : 01:18:39
|
in a view in a columnar format. thanks |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2010-02-01 : 01:36:12
|
quote: Originally posted by cutiebo2t in a view in a columnar format. thanks
Are you going to display them in a front end application?MadhivananFailing to plan is Planning to fail |
|
|
cutiebo2t
Constraint Violating Yak Guru
256 Posts |
Posted - 2010-02-01 : 01:56:15
|
no backend |
|
|
Previous Page&nsp;
Next Page
|