Click here to Skip to main content
15,899,313 members
Home / Discussions / Database
   

Database

 
AnswerRe: Database design question Pin
Luc Pattyn22-Jun-08 0:54
sitebuilderLuc Pattyn22-Jun-08 0:54 
AnswerRe: Database design question Pin
Scott Dorman22-Jun-08 1:19
professionalScott Dorman22-Jun-08 1:19 
GeneralRe: Database design question Pin
Mohammad A Gdeisat22-Jun-08 2:36
Mohammad A Gdeisat22-Jun-08 2:36 
GeneralRe: Database design question Pin
Scott Dorman22-Jun-08 3:06
professionalScott Dorman22-Jun-08 3:06 
AnswerRe: Database design question Pin
Ashfield22-Jun-08 21:04
Ashfield22-Jun-08 21:04 
QuestionSSIS fuzzy look up package Pin
Member 400849220-Jun-08 21:45
Member 400849220-Jun-08 21:45 
QuestionTranspose rows as columns Pin
Member 400849220-Jun-08 15:54
Member 400849220-Jun-08 15:54 
AnswerRe: Transpose rows as columns Pin
Ashfield21-Jun-08 7:27
Ashfield21-Jun-08 7:27 
This sould put you on the right track

/* create test table and populate */ 
create table UserArea(Country varchar(20))
insert into UserAreaselect 'India'
union all
select 'USA'
union all
select 'India'
union all
select 'UK'
/* now the actual code */
DECLARE @SQL nvarchar(4000)
SET @SQL=''   
SELECT @SQL= @SQL +'SUM(CASE WHEN Country=''' + a.Country + ''' THEN 1 ELSE 0 END) AS [' + a.Country + '],'
FROM (select distinct Country from UserArea) as a
select @SQL = left(@SQL,len(@SQL)-1)
SET @SQL='SELECT ' + @SQL + ' FROM UserArea'EXEC(@SQL)
/* tidy up */
drop table  UserArea


Bob
Ashfield Consultants Ltd

AnswerRe: Transpose rows as columns Pin
A Wong23-Jun-08 4:26
A Wong23-Jun-08 4:26 
QuestionIssue while updating the DateTime field thru VB.NET Pin
hariram2820-Jun-08 8:49
hariram2820-Jun-08 8:49 
AnswerRe: Issue while updating the DateTime field thru VB.NET Pin
Ashfield20-Jun-08 8:56
Ashfield20-Jun-08 8:56 
GeneralRe: Issue while updating the DateTime field thru VB.NET Pin
hariram2820-Jun-08 9:12
hariram2820-Jun-08 9:12 
GeneralRe: Issue while updating the DateTime field thru VB.NET Pin
Ashfield20-Jun-08 11:28
Ashfield20-Jun-08 11:28 
GeneralRe: Issue while updating the DateTime field thru VB.NET Pin
hariram2820-Jun-08 12:37
hariram2820-Jun-08 12:37 
GeneralRe: Issue while updating the DateTime field thru VB.NET Pin
Ashfield21-Jun-08 7:28
Ashfield21-Jun-08 7:28 
QuestionGenerating XML Schema of SQL Server 2005 Database Pin
Rocky#20-Jun-08 3:13
Rocky#20-Jun-08 3:13 
QuestionMySql and DbCommand [modified] Pin
gandalf_le_blanc20-Jun-08 3:10
gandalf_le_blanc20-Jun-08 3:10 
Questionexception handling sql server 2005 Pin
Learner52020-Jun-08 2:20
Learner52020-Jun-08 2:20 
AnswerRe: exception handling sql server 2005 Pin
Hesham Amin20-Jun-08 6:01
Hesham Amin20-Jun-08 6:01 
GeneralRe: exception handling sql server 2005 Pin
Learner52020-Jun-08 6:17
Learner52020-Jun-08 6:17 
QuestionChange data arrangement Pin
SomeGuyThatIsMe20-Jun-08 1:28
SomeGuyThatIsMe20-Jun-08 1:28 
QuestionRecommendation for SQL Server book Pin
Baconbutty19-Jun-08 22:48
Baconbutty19-Jun-08 22:48 
AnswerRe: Recommendation for SQL Server book Pin
Alsvha19-Jun-08 23:50
Alsvha19-Jun-08 23:50 
QuestionAutomatic Transaction between MySQL and MSMQ Pin
jmohan19-Jun-08 22:02
jmohan19-Jun-08 22:02 
GeneralOLAP Cube for Sql server 2005 Pin
jagmit2019-Jun-08 20:45
jagmit2019-Jun-08 20:45 

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.