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

Database

 
AnswerRe: Load JSON file from network location Pin
Mycroft Holmes3-Jun-21 12:15
professionalMycroft Holmes3-Jun-21 12:15 
QuestionSQL Server 2010, smalldatetime insert Pin
jkirkerx1-Jun-21 14:52
professionaljkirkerx1-Jun-21 14:52 
AnswerRe: SQL Server 2010, smalldatetime insert Pin
Mycroft Holmes1-Jun-21 21:31
professionalMycroft Holmes1-Jun-21 21:31 
AnswerRe: SQL Server 2010, smalldatetime insert Pin
Victor Nijegorodov1-Jun-21 21:49
Victor Nijegorodov1-Jun-21 21:49 
AnswerRe: SQL Server 2010, smalldatetime insert Pin
jkirkerx2-Jun-21 8:47
professionaljkirkerx2-Jun-21 8:47 
QuestionGet columns name Pin
_Flaviu27-May-21 23:55
_Flaviu27-May-21 23:55 
AnswerRe: Get columns name Pin
Victor Nijegorodov28-May-21 0:22
Victor Nijegorodov28-May-21 0:22 
GeneralRe: Get columns name Pin
_Flaviu3-Jun-21 5:57
_Flaviu3-Jun-21 5:57 
GeneralRe: Get columns name Pin
Victor Nijegorodov3-Jun-21 20:13
Victor Nijegorodov3-Jun-21 20:13 
GeneralRe: Get columns name Pin
_Flaviu3-Jun-21 20:37
_Flaviu3-Jun-21 20:37 
GeneralRe: Get columns name Pin
Victor Nijegorodov3-Jun-21 21:48
Victor Nijegorodov3-Jun-21 21:48 
GeneralRe: Get columns name Pin
_Flaviu3-Jun-21 23:33
_Flaviu3-Jun-21 23:33 
GeneralRe: Get columns name Pin
Victor Nijegorodov4-Jun-21 0:55
Victor Nijegorodov4-Jun-21 0:55 
AnswerRe: Get columns name Pin
Gerry Schmitz4-Jun-21 7:02
mveGerry Schmitz4-Jun-21 7:02 
GeneralRe: Get columns name Pin
Victor Nijegorodov4-Jun-21 7:21
Victor Nijegorodov4-Jun-21 7:21 
GeneralRe: Get columns name Pin
Gerry Schmitz4-Jun-21 7:54
mveGerry Schmitz4-Jun-21 7:54 
GeneralRe: Get columns name Pin
Victor Nijegorodov4-Jun-21 8:02
Victor Nijegorodov4-Jun-21 8:02 
GeneralRe: Get columns name Pin
Gerry Schmitz4-Jun-21 9:01
mveGerry Schmitz4-Jun-21 9:01 
GeneralRe: Get columns name Pin
Victor Nijegorodov4-Jun-21 9:47
Victor Nijegorodov4-Jun-21 9:47 
AnswerRe: Get columns name Pin
Mycroft Holmes4-Jun-21 12:43
professionalMycroft Holmes4-Jun-21 12:43 
AnswerRe: Get columns name Pin
mverbeke31-Aug-21 3:59
mverbeke31-Aug-21 3:59 
SuggestionRe: Get columns name Pin
Richard Deeming31-Aug-21 4:50
mveRichard Deeming31-Aug-21 4:50 
I suggest you read the documentation:
Column IDs might not be sequential.
If a column has ever been dropped from the table, you will end up with gaps in the column ID sequence.

To get a true ordinal position, you'd need to use the ROW_NUMBER windowing function - for example:
SQL
SELECT [name], ROW_NUMBER() OVER (ORDER BY [column_id]) As [Ordinal]
FROM sys.columns
WHERE [object_id] = OBJECT_ID('MyTable')
ORDER BY [column_id]




"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer

QuestionSQL statements Pin
Erick Kaira27-May-21 8:09
Erick Kaira27-May-21 8:09 
AnswerRe: SQL statements Pin
Victor Nijegorodov27-May-21 8:40
Victor Nijegorodov27-May-21 8:40 
AnswerRe: SQL statements Pin
SeanChupas27-May-21 9:02
SeanChupas27-May-21 9:02 

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.