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

Database

 
GeneralRe: Crazy many data from database to array then a lot of calculation Pin
crunchor27-Jun-13 6:13
crunchor27-Jun-13 6:13 
GeneralRe: Crazy many data from database to array then a lot of calculation Pin
Simon_Whale27-Jun-13 1:51
Simon_Whale27-Jun-13 1:51 
QuestionSelect statement: ordering by column name. Pin
Septimus Hedgehog24-Jun-13 0:06
Septimus Hedgehog24-Jun-13 0:06 
AnswerRe: Select statement: ordering by column name. Pin
Eddy Vluggen24-Jun-13 0:32
professionalEddy Vluggen24-Jun-13 0:32 
GeneralRe: Select statement: ordering by column name. Pin
Septimus Hedgehog24-Jun-13 0:55
Septimus Hedgehog24-Jun-13 0:55 
AnswerRe: Select statement: ordering by column name. Pin
Mycroft Holmes24-Jun-13 1:41
professionalMycroft Holmes24-Jun-13 1:41 
GeneralRe: Select statement: ordering by column name. Pin
Septimus Hedgehog24-Jun-13 1:55
Septimus Hedgehog24-Jun-13 1:55 
AnswerRe: Select statement: ordering by column name. Pin
GuyThiebaut24-Jun-13 2:10
professionalGuyThiebaut24-Jun-13 2:10 
This will do the trick for one table.

Just build another cursor around this cursor to do it by table.
(my Jedi senses tell that I am going to get flamed by someone for suggesting a cursor)

SQL
DECLARE curs CURSOR FOR 
SELECT COLUMN_NAME
FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_NAME = 'yourTable'
ORDER BY column_name

declare @qry as nvarchar(max)
set @qry = 'select '

DECLARE @col nvarchar(max)

OPEN curs
FETCH NEXT FROM curs into @col
WHILE @@FETCH_STATUS = 0
BEGIN
  set @qry += '['+@col + '],'
	FETCH NEXT FROM curs into @col
END

CLOSE curs
DEALLOCATE curs  

set @qry = substring(@qry,1,len(@qry)-1) + ' from yourTable'

exec(@qry)

“That which can be asserted without evidence, can be dismissed without evidence.”

― Christopher Hitchens


modified 24-Jun-13 9:46am.

GeneralRe: Select statement: ordering by column name. Pin
Tim Carmichael24-Jun-13 4:23
Tim Carmichael24-Jun-13 4:23 
GeneralRe: Select statement: ordering by column name. Pin
GuyThiebaut24-Jun-13 5:03
professionalGuyThiebaut24-Jun-13 5:03 
AnswerRe: Select statement: ordering by column name. Pin
David Mujica24-Jun-13 2:37
David Mujica24-Jun-13 2:37 
AnswerRe: Select statement: ordering by column name. Pin
Ralph D. Wilson II10-Jul-13 7:40
Ralph D. Wilson II10-Jul-13 7:40 
GeneralRe: Select statement: ordering by column name. Pin
Septimus Hedgehog10-Jul-13 20:11
Septimus Hedgehog10-Jul-13 20:11 
GeneralRe: Select statement: ordering by column name. Pin
Ralph D. Wilson II11-Jul-13 7:15
Ralph D. Wilson II11-Jul-13 7:15 
GeneralRe: Select statement: ordering by column name. Pin
Septimus Hedgehog11-Jul-13 10:27
Septimus Hedgehog11-Jul-13 10:27 
GeneralRe: Select statement: ordering by column name. Pin
Ralph D. Wilson II31-Jul-13 5:59
Ralph D. Wilson II31-Jul-13 5:59 
GeneralRe: Select statement: ordering by column name. Pin
Septimus Hedgehog31-Jul-13 7:46
Septimus Hedgehog31-Jul-13 7:46 
QuestionSQL Database Security Pin
Zeyad Jalil22-Jun-13 0:04
professionalZeyad Jalil22-Jun-13 0:04 
AnswerRe: SQL Database Security Pin
Eddy Vluggen22-Jun-13 7:24
professionalEddy Vluggen22-Jun-13 7:24 
AnswerRe: SQL Database Security Pin
Mycroft Holmes22-Jun-13 13:40
professionalMycroft Holmes22-Jun-13 13:40 
Generalmysql or postgresql for Ubuntu + Java trading system? Pin
crunchor21-Jun-13 20:41
crunchor21-Jun-13 20:41 
GeneralRe: mysql or postgresql for Ubuntu + Java trading system? Pin
Rutvik Dave21-Jun-13 21:20
professionalRutvik Dave21-Jun-13 21:20 
GeneralRe: mysql or postgresql for Ubuntu + Java trading system? Pin
Matthew Faithfull21-Jun-13 21:51
Matthew Faithfull21-Jun-13 21:51 
GeneralRe: mysql or postgresql for Ubuntu + Java trading system? Pin
crunchor21-Jun-13 23:56
crunchor21-Jun-13 23:56 
GeneralRe: mysql or postgresql for Ubuntu + Java trading system? Pin
Bernhard Hiller23-Jun-13 21:25
Bernhard Hiller23-Jun-13 21:25 

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.