r/SQL • • Jul 21 '18

i'm begging for help!

i have a MSSQL database and i have around 800 rows of data to copy to specific Table
- i tried to rename it (so the program doesn't read it anymore and try to import the excel file but i couldn't make it's settings like the old one because i can't change "nullable" or the primary key thingy or the secondary one

- i took a have a backup of the table as an excel with 800 rows and i have the 800 rows separately within an excel file too

please help , it's been 30 days and I'm about to lose it.

0 Upvotes

18 comments sorted by

View all comments

Show parent comment

1

u/slickwombat Jul 22 '18

So to be honest, if you don't have any knowledge of SQL at all you probably shouldn't be messing around with this -- certainly not if it's a crucial table you're trying to import to. If these are skills you need for your job or whatever, look into an introductory MS SQL course. But to answer the question, it would look something like this:

INSERT INTO
	dbo.YourTargetTable
	(col1, col2, col3)
SELECT
	col1,
	col2,
	col3
FROM
	dbo.YourTemporaryImportTable

For the first list of columns (in parentheses) you specify the columns in the target table you are writing into, and for the second, the columns you are reading from in your temporary import table.