Click here to Skip to main content
15,903,175 members
Home / Discussions / Database
   

Database

 
AnswerRe: Dbf Tables & Sql Strings Pin
Eric Dahlvang24-May-06 3:06
Eric Dahlvang24-May-06 3:06 
Question-- Is it possible??? -- Pin
WetRivrRat23-May-06 9:56
WetRivrRat23-May-06 9:56 
AnswerRe: -- Is it possible??? -- Pin
Eric Dahlvang24-May-06 3:36
Eric Dahlvang24-May-06 3:36 
GeneralRe: -- Is it possible??? -- Pin
WetRivrRat24-May-06 4:01
WetRivrRat24-May-06 4:01 
AnswerRe: -- Is it possible??? -- Pin
Eric Dahlvang24-May-06 8:35
Eric Dahlvang24-May-06 8:35 
AnswerRe: -- Is it possible??? -- [modified] Pin
Michael Potter24-May-06 3:41
Michael Potter24-May-06 3:41 
GeneralRe: -- Is it possible??? -- Pin
WetRivrRat24-May-06 4:16
WetRivrRat24-May-06 4:16 
GeneralRe: -- Is it possible??? -- Pin
Eric Dahlvang24-May-06 9:31
Eric Dahlvang24-May-06 9:31 
Here is another solution, but with this no employee can have two of the same phone type:

DECLARE @iColumns INT, @sql VARCHAR(2500),@cTypeID VARCHAR(10) 

SET @sql = ''

DECLARE curTypes CURSOR FOR SELECT  DISTINCT CAST(teltype AS VARCHAR(10)) FROM PhoneNumbers
OPEN curTypes
FETCH NEXT FROM curTypes INTO @cTypeID
WHILE @@FETCH_STATUS = 0
BEGIN
	SET @sql = @sql + ', (SELECT phone_num FROM PhoneNumbers p WHERE p.empid = e.empid AND p.teltype = ' + @cTypeID + ') as Type' + @cTypeID
	FETCH NEXT FROM curTypes INTO @cTypeID
END

close  curTypes
DEALLOCATE curTypes

SET @sql =  'SELECT e.name,e.empid' + @sql + ' FROM employees e'
exec(@sql)


----------
There go my people. I must find out where they are going so I can lead them.
- Alexander Ledru-Rollin

QuestionPls Help MS Access Pin
achrafus23-May-06 8:46
achrafus23-May-06 8:46 
QuestionSQL Express to Access Pin
Kschuler23-May-06 8:29
Kschuler23-May-06 8:29 
AnswerRe: SQL Express to Access Pin
Eric Dahlvang23-May-06 9:29
Eric Dahlvang23-May-06 9:29 
QuestionBest way to get Today in DateTime Pin
Rob Philpott23-May-06 7:07
Rob Philpott23-May-06 7:07 
AnswerRe: Best way to get Today in DateTime Pin
Eric Dahlvang23-May-06 8:00
Eric Dahlvang23-May-06 8:00 
GeneralRe: Best way to get Today in DateTime Pin
Rob Philpott23-May-06 8:07
Rob Philpott23-May-06 8:07 
GeneralRe: Best way to get Today in DateTime Pin
Eric Dahlvang23-May-06 8:29
Eric Dahlvang23-May-06 8:29 
QuestionInserting Image in my Report (ReportViewer) Pin
anderslundsgard23-May-06 4:28
anderslundsgard23-May-06 4:28 
QuestionProgrammatically Updating a Table with Detail from derived from another Table Pin
AnneThorne23-May-06 3:45
AnneThorne23-May-06 3:45 
QuestionData base connection problem Pin
iz723-May-06 2:28
iz723-May-06 2:28 
QuestionSQL Server does not exist or access denied [modified] Pin
sarah_chandran23-May-06 0:57
sarah_chandran23-May-06 0:57 
AnswerRe: SQL Server does not exist or access denied [modified] Pin
sathish s23-May-06 2:11
sathish s23-May-06 2:11 
GeneralRe: SQL Server does not exist or access denied [modified] Pin
sarah_chandran23-May-06 3:14
sarah_chandran23-May-06 3:14 
Questionwriting query using comma separator Pin
dayakar_dn23-May-06 0:09
dayakar_dn23-May-06 0:09 
AnswerRe: writing query using comma separator [modified] Pin
Frank Kerrigan23-May-06 0:46
Frank Kerrigan23-May-06 0:46 
Questionado.net Pin
ravikiranreddydharmannagari22-May-06 23:22
ravikiranreddydharmannagari22-May-06 23:22 
AnswerRe: ado.net Pin
dayakar_dn23-May-06 1:49
dayakar_dn23-May-06 1:49 

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.