Click here to Skip to main content
15,919,132 members
Home / Discussions / Database
   

Database

 
AnswerRe: Update new date in database Pin
mr_lasseter25-Aug-06 2:57
mr_lasseter25-Aug-06 2:57 
AnswerRe: Update new date in database Pin
Eric Dahlvang25-Aug-06 4:02
Eric Dahlvang25-Aug-06 4:02 
QuestionPopulate label from SQL query... Pin
japel24-Aug-06 20:03
japel24-Aug-06 20:03 
AnswerRe: Populate label from SQL query... Pin
Colin Angus Mackay24-Aug-06 22:47
Colin Angus Mackay24-Aug-06 22:47 
GeneralRe: Populate label from SQL query... Pin
japel25-Aug-06 0:17
japel25-Aug-06 0:17 
Questionhow do i print the number of rows with same item in 1 column? [modified] Pin
kozu24-Aug-06 17:49
kozu24-Aug-06 17:49 
AnswerRe: how do i print the number of rows with same item in 1 column? Pin
Colin Angus Mackay24-Aug-06 22:44
Colin Angus Mackay24-Aug-06 22:44 
AnswerRe: how do i print the number of rows with same item in 1 column? Pin
Eric Dahlvang25-Aug-06 4:23
Eric Dahlvang25-Aug-06 4:23 
Colin answered your first question. Here is a solution for the second:
Make a User Defined Function:
CREATE FUNCTION GetData (@cName varchar(100))  
RETURNS varchar(100) AS  
BEGIN 

DECLARE @nData int
DECLARE @cDataHold varchar(100)
SELECT @cDataHold = ''

DECLARE  DataCursor CURSOR FOR 
SELECT Data 
FROM TestTable
WHERE Name = @cName

OPEN DataCursor
FETCH NEXT FROM DataCursor INTO @nData 
WHILE @@FETCH_STATUS = 0
BEGIN
	select @cDataHold = @cDataHold + case when len(@cDataHold) > 0 then ', ' else '' end + CAST(@nData as varchar(100))
	FETCH NEXT FROM DataCursor INTO @nData 
END

CLOSE DataCursor
DEALLOCATE DataCursor
RETURN(@cDataHold)
END

Call it like this:
select name, dbo.getdata(name) as Data from (select distinct name from TestTable) as tbl


--EricDV Sig---------
Some problems are so complex that you have to be highly intelligent and well informed just to be undecided about them.
- Laurence J. Peters

GeneralRe: how do i print the number of rows with same item in 1 column? Pin
kozu25-Aug-06 4:53
kozu25-Aug-06 4:53 
QuestionSQL and C# problem [modified] Pin
William Ten Broek24-Aug-06 11:30
William Ten Broek24-Aug-06 11:30 
AnswerLDAP Pin
Ennis Ray Lynch, Jr.24-Aug-06 11:33
Ennis Ray Lynch, Jr.24-Aug-06 11:33 
QuestionHow to do a Select/Where x=NULL Pin
TheJudeDude24-Aug-06 11:09
TheJudeDude24-Aug-06 11:09 
AnswerRe: How to do a Select/Where x=NULL Pin
Colin Angus Mackay24-Aug-06 11:19
Colin Angus Mackay24-Aug-06 11:19 
GeneralRe: How to do a Select/Where x=NULL Pin
TheJudeDude24-Aug-06 11:25
TheJudeDude24-Aug-06 11:25 
AnswerRe: How to do a Select/Where x=NULL Pin
S Pandian25-Aug-06 22:37
S Pandian25-Aug-06 22:37 
QuestionProgramming SQL Database Question Pin
Jethro6324-Aug-06 10:11
Jethro6324-Aug-06 10:11 
AnswerRe: Programming SQL Database Question Pin
Colin Angus Mackay24-Aug-06 11:23
Colin Angus Mackay24-Aug-06 11:23 
GeneralRe: Programming SQL Database Question Pin
Jethro6327-Aug-06 21:22
Jethro6327-Aug-06 21:22 
GeneralRe: Programming SQL Database Question Pin
Colin Angus Mackay27-Aug-06 21:51
Colin Angus Mackay27-Aug-06 21:51 
GeneralRe: Programming SQL Database Question Pin
Jethro6329-Aug-06 3:05
Jethro6329-Aug-06 3:05 
GeneralRe: Programming SQL Database Question Pin
Colin Angus Mackay29-Aug-06 11:23
Colin Angus Mackay29-Aug-06 11:23 
GeneralRe: Programming SQL Database Question Pin
Jethro6331-Aug-06 3:17
Jethro6331-Aug-06 3:17 
GeneralRe: Programming SQL Database Question Pin
Colin Angus Mackay31-Aug-06 8:49
Colin Angus Mackay31-Aug-06 8:49 
GeneralRe: Programming SQL Database Question Pin
Jethro6331-Aug-06 9:13
Jethro6331-Aug-06 9:13 
QuestionPage Performance Pin
Amit Kumar G24-Aug-06 7:41
Amit Kumar G24-Aug-06 7:41 

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.