Click here to Skip to main content
16,005,120 members
Home / Discussions / Database
   

Database

 
AnswerRe: Query Pin
Eddy Vluggen14-Apr-09 10:10
professionalEddy Vluggen14-Apr-09 10:10 
Questiondatacolumn boxing Pin
Maverickcool13-Apr-09 22:02
Maverickcool13-Apr-09 22:02 
AnswerRe: datacolumn boxing Pin
Mycroft Holmes14-Apr-09 17:05
professionalMycroft Holmes14-Apr-09 17:05 
GeneralRe: datacolumn boxing Pin
Maverickcool14-Apr-09 23:55
Maverickcool14-Apr-09 23:55 
GeneralRe: datacolumn boxing Pin
Mycroft Holmes15-Apr-09 1:18
professionalMycroft Holmes15-Apr-09 1:18 
AnswerRe: datacolumn boxing Pin
jai_10124-Apr-09 21:49
jai_10124-Apr-09 21:49 
Questionmultiline dynamic tsql - recognize line break? Pin
devvvy13-Apr-09 20:22
devvvy13-Apr-09 20:22 
AnswerRe: multiline dynamic tsql - recognize line break? Pin
devvvy13-Apr-09 20:46
devvvy13-Apr-09 20:46 
QuestionDifference between datatype uniqueidentifier and int for a primary key? Pin
pzn3xq13-Apr-09 10:07
pzn3xq13-Apr-09 10:07 
AnswerRe: Difference between datatype uniqueidentifier and int for a primary key? Pin
Colin Angus Mackay13-Apr-09 12:16
Colin Angus Mackay13-Apr-09 12:16 
Questionconverting from varbinary(max) to xml Pin
amer shammout12-Apr-09 22:48
amer shammout12-Apr-09 22:48 
QuestionRe: converting from varbinary(max) to xml Pin
Eddy Vluggen13-Apr-09 0:02
professionalEddy Vluggen13-Apr-09 0:02 
AnswerRe: converting from varbinary(max) to xml Pin
amer shammout13-Apr-09 0:17
amer shammout13-Apr-09 0:17 
GeneralRe: converting from varbinary(max) to xml Pin
Eddy Vluggen13-Apr-09 1:38
professionalEddy Vluggen13-Apr-09 1:38 
GeneralRe: converting from varbinary(max) to xml Pin
amer shammout20-Apr-09 2:47
amer shammout20-Apr-09 2:47 
QuestionData base notification Pin
anishkannan12-Apr-09 20:26
anishkannan12-Apr-09 20:26 
AnswerRe: Data base notification Pin
Giorgi Dalakishvili12-Apr-09 21:12
mentorGiorgi Dalakishvili12-Apr-09 21:12 
QuestionNeed a Query... [modified] Pin
Jamal Abdul Nasir12-Apr-09 5:22
Jamal Abdul Nasir12-Apr-09 5:22 
AnswerRe: Need a Query... Pin
Henry Minute12-Apr-09 8:03
Henry Minute12-Apr-09 8:03 
AnswerRe: Need a Query... Pin
Le centriste14-Apr-09 5:13
Le centriste14-Apr-09 5:13 
QuestionMerging rows from different tables to form a single row. Pin
Abhilash Raja11-Apr-09 22:42
Abhilash Raja11-Apr-09 22:42 
AnswerRe: Merging rows from different tables to form a single row. [modified] Pin
Eddy Vluggen12-Apr-09 0:08
professionalEddy Vluggen12-Apr-09 0:08 
GeneralRe: Merging rows from different tables to form a single row. Pin
Abhilash Raja12-Apr-09 1:49
Abhilash Raja12-Apr-09 1:49 
Hi,
I found a solution but i dont know if its the best performance wise.

Note :dbo.COM_FN_SplitString : it splits a string based on the delimiter passed

/*****Code*****/
Declare @table1 as table(rowID int IDENTITY(1,1),GroupId int)
Declare @table2 as table(rowID int IDENTITY(1,1),Cost Numeric(10,2))
Declare @table3 as table(rowID int IDENTITY(1,1),Currency Varchar(max))
Declare @resultTable as table(GroupId int,Cost Numeric(10,2),Currency Varchar(max))



Insert into @table1(GroupId) SELECT Convert(int,s) as GroupId From dbo.COM_FN_SplitString('1,2,3',',')

Insert into @table2(Cost) SELECT Convert(Numeric(10,2),s) From dbo.COM_FN_SplitString('30.0,35.5,40.0',',')

Insert into @table3(Currency) SELECT s From dbo.COM_FN_SplitString('Dollar,Pound,Dollar',',')

Insert into @resultTable(GroupId,Cost,Currency)
select GroupId,Cost,Currency From
@table1 as t1
inner join
@table2 as t2
on t1.rowID = t2.rowID
inner join
@table3 as t3
on t3.rowID = t1.rowID

select * From @resultTable
/*****Code*****/
GeneralRe: Merging rows from different tables to form a single row. Pin
Eddy Vluggen12-Apr-09 4:32
professionalEddy Vluggen12-Apr-09 4:32 
QuestionRow As Column Pin
Saiyed Alam11-Apr-09 2:58
Saiyed Alam11-Apr-09 2:58 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.