Reset Column Header IndexExporting from SQL Server 2005 for import into ER Studio 9.0Why does Management Studio not automatically create FK column in the parent table?Header and line item data source mismatchIndex will be removedChanging an nvarchar column to datetimeCode required to make column not nullableColumn Name in separate table SQL ServerTwo SQL Server databases share the same MDF and LDF files but have different datajoin two tables, include one row from the parent table for each primary keySQL don't display ORDER BY column
What kind of vegetable has pink and white concentric rings?
Claiming statutory warranty for a fault that resulted in the loss of the product
Why was Quirrell said to be in the Black Forest if Voldemort was actually in Albania?
Plotting maxima within a simplex
Why does airflow separate from the wing during stall?
What should I watch before playing Alien: Isolation?
How did pilots avoid thunderstorms and related weather before “reliable” airborne weather radar was introduced on airliners?
Do I have to mention my main character's age?
Quickest way to move a line in a text file before another line in a text file?
Is it better to have a 10 year gap or a bad reference?
How can I deal with someone that wants to kill something that isn't supposed to be killed?
How can I remove studs and screws from the inside of drywall when installing a pocket door without needing to do paint and patch work on both sides?
How should I handle a question regarding my regrets during an interview?
Reset Column Header Index
Strange LED behavior
Why didn't NASA launch communications relay satellites for the Apollo missions?
"It is what it is"
Why are Oscar, India, and X-Ray (O, I, and X) not used as taxiway identifiers?
Can "Taking algebraic closure" be made into a functor?
Oriented vector bundle with odd-dimensional fibers
What kind of curve (or model) should I fit to my percentage data?
How much did NASA help with the making of "First Man"?
Reflect IR beam off reflector instead of emitting straight to TSOP receiver
Is it better to merge "often" or only after completion do a big merge of feature branches?
Reset Column Header Index
Exporting from SQL Server 2005 for import into ER Studio 9.0Why does Management Studio not automatically create FK column in the parent table?Header and line item data source mismatchIndex will be removedChanging an nvarchar column to datetimeCode required to make column not nullableColumn Name in separate table SQL ServerTwo SQL Server databases share the same MDF and LDF files but have different datajoin two tables, include one row from the parent table for each primary keySQL don't display ORDER BY column
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I uploaded some tables to SQL Server Management Studio. Upon inspecting the tables I've found that the column headers area actually values. Is there any way to bump the headers down into a new row and to create new column headers, or will I have to re-upload all of the tables and remember to select the 'has header' option?
Thanks.
sql-server
New contributor
CharlesD is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
add a comment |
I uploaded some tables to SQL Server Management Studio. Upon inspecting the tables I've found that the column headers area actually values. Is there any way to bump the headers down into a new row and to create new column headers, or will I have to re-upload all of the tables and remember to select the 'has header' option?
Thanks.
sql-server
New contributor
CharlesD is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
1
from what source you uploaded the tables? Excel or CSV?
– Rajesh Ranjan
8 hours ago
Sorry, I should have mentioned that. Excel, it was one sheet with several tabs.
– CharlesD
8 hours ago
add a comment |
I uploaded some tables to SQL Server Management Studio. Upon inspecting the tables I've found that the column headers area actually values. Is there any way to bump the headers down into a new row and to create new column headers, or will I have to re-upload all of the tables and remember to select the 'has header' option?
Thanks.
sql-server
New contributor
CharlesD is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
I uploaded some tables to SQL Server Management Studio. Upon inspecting the tables I've found that the column headers area actually values. Is there any way to bump the headers down into a new row and to create new column headers, or will I have to re-upload all of the tables and remember to select the 'has header' option?
Thanks.
sql-server
sql-server
New contributor
CharlesD is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
CharlesD is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
CharlesD is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
asked 9 hours ago
CharlesDCharlesD
233 bronze badges
233 bronze badges
New contributor
CharlesD is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
CharlesD is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
1
from what source you uploaded the tables? Excel or CSV?
– Rajesh Ranjan
8 hours ago
Sorry, I should have mentioned that. Excel, it was one sheet with several tabs.
– CharlesD
8 hours ago
add a comment |
1
from what source you uploaded the tables? Excel or CSV?
– Rajesh Ranjan
8 hours ago
Sorry, I should have mentioned that. Excel, it was one sheet with several tabs.
– CharlesD
8 hours ago
1
1
from what source you uploaded the tables? Excel or CSV?
– Rajesh Ranjan
8 hours ago
from what source you uploaded the tables? Excel or CSV?
– Rajesh Ranjan
8 hours ago
Sorry, I should have mentioned that. Excel, it was one sheet with several tabs.
– CharlesD
8 hours ago
Sorry, I should have mentioned that. Excel, it was one sheet with several tabs.
– CharlesD
8 hours ago
add a comment |
2 Answers
2
active
oldest
votes
Probably the least complicated option would be to select all your data into a new table with the correct column names, filtering out the row of values containing the header values. From there, you can drop the malformed table, and rename the new one.
Example:
CREATE TABLE dbo.wrongo(wrong INT, [column] INT, names INT);
CREATE TABLE dbo.righto(correct INT, [column] INT, names INT);
INSERT dbo.righto ( correct, [column], names )
SELECT wrong, [column], names
FROM dbo.wrongo
WHERE wrongo.wrong <> 'column name'; --this will throw an error, but you get the idea.
DROP TABLE dbo.wrongo;
EXEC sp_rename 'dbo.righto', 'wrongo', 'OBJECT';
add a comment |
There are two ways you can avoid having values as columns name while loading data from excel source.
- Create the table in the database using the
CREATE TABLEstatement and then upload data using DTS. - Mention column names as the first record in the excel sheet and upload it.
There are other ways too, but these are easier steps.
Thanks!
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "182"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
CharlesD is a new contributor. Be nice, and check out our Code of Conduct.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fdba.stackexchange.com%2fquestions%2f243468%2freset-column-header-index%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
Probably the least complicated option would be to select all your data into a new table with the correct column names, filtering out the row of values containing the header values. From there, you can drop the malformed table, and rename the new one.
Example:
CREATE TABLE dbo.wrongo(wrong INT, [column] INT, names INT);
CREATE TABLE dbo.righto(correct INT, [column] INT, names INT);
INSERT dbo.righto ( correct, [column], names )
SELECT wrong, [column], names
FROM dbo.wrongo
WHERE wrongo.wrong <> 'column name'; --this will throw an error, but you get the idea.
DROP TABLE dbo.wrongo;
EXEC sp_rename 'dbo.righto', 'wrongo', 'OBJECT';
add a comment |
Probably the least complicated option would be to select all your data into a new table with the correct column names, filtering out the row of values containing the header values. From there, you can drop the malformed table, and rename the new one.
Example:
CREATE TABLE dbo.wrongo(wrong INT, [column] INT, names INT);
CREATE TABLE dbo.righto(correct INT, [column] INT, names INT);
INSERT dbo.righto ( correct, [column], names )
SELECT wrong, [column], names
FROM dbo.wrongo
WHERE wrongo.wrong <> 'column name'; --this will throw an error, but you get the idea.
DROP TABLE dbo.wrongo;
EXEC sp_rename 'dbo.righto', 'wrongo', 'OBJECT';
add a comment |
Probably the least complicated option would be to select all your data into a new table with the correct column names, filtering out the row of values containing the header values. From there, you can drop the malformed table, and rename the new one.
Example:
CREATE TABLE dbo.wrongo(wrong INT, [column] INT, names INT);
CREATE TABLE dbo.righto(correct INT, [column] INT, names INT);
INSERT dbo.righto ( correct, [column], names )
SELECT wrong, [column], names
FROM dbo.wrongo
WHERE wrongo.wrong <> 'column name'; --this will throw an error, but you get the idea.
DROP TABLE dbo.wrongo;
EXEC sp_rename 'dbo.righto', 'wrongo', 'OBJECT';
Probably the least complicated option would be to select all your data into a new table with the correct column names, filtering out the row of values containing the header values. From there, you can drop the malformed table, and rename the new one.
Example:
CREATE TABLE dbo.wrongo(wrong INT, [column] INT, names INT);
CREATE TABLE dbo.righto(correct INT, [column] INT, names INT);
INSERT dbo.righto ( correct, [column], names )
SELECT wrong, [column], names
FROM dbo.wrongo
WHERE wrongo.wrong <> 'column name'; --this will throw an error, but you get the idea.
DROP TABLE dbo.wrongo;
EXEC sp_rename 'dbo.righto', 'wrongo', 'OBJECT';
answered 8 hours ago
Erik DarlingErik Darling
25.9k13 gold badges79 silver badges128 bronze badges
25.9k13 gold badges79 silver badges128 bronze badges
add a comment |
add a comment |
There are two ways you can avoid having values as columns name while loading data from excel source.
- Create the table in the database using the
CREATE TABLEstatement and then upload data using DTS. - Mention column names as the first record in the excel sheet and upload it.
There are other ways too, but these are easier steps.
Thanks!
add a comment |
There are two ways you can avoid having values as columns name while loading data from excel source.
- Create the table in the database using the
CREATE TABLEstatement and then upload data using DTS. - Mention column names as the first record in the excel sheet and upload it.
There are other ways too, but these are easier steps.
Thanks!
add a comment |
There are two ways you can avoid having values as columns name while loading data from excel source.
- Create the table in the database using the
CREATE TABLEstatement and then upload data using DTS. - Mention column names as the first record in the excel sheet and upload it.
There are other ways too, but these are easier steps.
Thanks!
There are two ways you can avoid having values as columns name while loading data from excel source.
- Create the table in the database using the
CREATE TABLEstatement and then upload data using DTS. - Mention column names as the first record in the excel sheet and upload it.
There are other ways too, but these are easier steps.
Thanks!
answered 8 hours ago
Rajesh RanjanRajesh Ranjan
1,3345 silver badges23 bronze badges
1,3345 silver badges23 bronze badges
add a comment |
add a comment |
CharlesD is a new contributor. Be nice, and check out our Code of Conduct.
CharlesD is a new contributor. Be nice, and check out our Code of Conduct.
CharlesD is a new contributor. Be nice, and check out our Code of Conduct.
CharlesD is a new contributor. Be nice, and check out our Code of Conduct.
Thanks for contributing an answer to Database Administrators Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fdba.stackexchange.com%2fquestions%2f243468%2freset-column-header-index%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
from what source you uploaded the tables? Excel or CSV?
– Rajesh Ranjan
8 hours ago
Sorry, I should have mentioned that. Excel, it was one sheet with several tabs.
– CharlesD
8 hours ago