Click here to Skip to main content
15,893,368 members
Home / Discussions / Database
   

Database

 
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 
Answerrepost Pin
Luc 64801111-Apr-09 3:23
Luc 64801111-Apr-09 3:23 
AnswerRe: Row As Column Pin
Mycroft Holmes11-Apr-09 15:52
professionalMycroft Holmes11-Apr-09 15:52 
GeneralRe: Row As Column Pin
Saiyed Alam11-Apr-09 21:07
Saiyed Alam11-Apr-09 21:07 
Questionlocking mdb file Pin
Pankaj Deharia11-Apr-09 2:46
professionalPankaj Deharia11-Apr-09 2:46 
AnswerRe: locking mdb file Pin
Henry Minute11-Apr-09 2:53
Henry Minute11-Apr-09 2:53 
AnswerRe: locking mdb file Pin
Luc 64801111-Apr-09 3:27
Luc 64801111-Apr-09 3:27 
Questionhow to use ObjectDataSource Pin
JAYRAJ GIRI11-Apr-09 2:10
JAYRAJ GIRI11-Apr-09 2:10 
AnswerRe: how to use ObjectDataSource Pin
Mycroft Holmes11-Apr-09 15:54
professionalMycroft Holmes11-Apr-09 15:54 
QuestionColumn as row Pin
Saiyed Alam10-Apr-09 6:21
Saiyed Alam10-Apr-09 6:21 
AnswerRe: Column as row Pin
Luc 64801110-Apr-09 7:05
Luc 64801110-Apr-09 7:05 
QuestionIif() statement usage problem [modified] Pin
dasha_pl10-Apr-09 0:55
dasha_pl10-Apr-09 0:55 
AnswerRe: Iif() statement usage problem Pin
riced10-Apr-09 4:11
riced10-Apr-09 4:11 
Questioncan I use '+=' in a datarow Pin
Maverickcool9-Apr-09 21:52
Maverickcool9-Apr-09 21:52 
AnswerRe: can I use '+=' in a datarow Pin
Mycroft Holmes9-Apr-09 22:25
professionalMycroft Holmes9-Apr-09 22:25 
AnswerRe: can I use '+=' in a datarow Pin
Colin Angus Mackay10-Apr-09 8:15
Colin Angus Mackay10-Apr-09 8:15 

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.