|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Generate data entry and reporting .NET Web apps in minutes, straight from your database. Read our FREE whitepaper “Build Web 2.0 Applications Without Hand-Coding” Download now! |
|
#1
|
|||
|
|||
|
I am trying to import a sql table with Query Analyzer. I opened up the Query Analyzer, found the sql table I needed, opened it and it read everything in the table. I see the execution script that defines the headers and the data type for all the columns and the information populated below that. So I told it to "Run".
It says it is executing the query batch, I see the globe spinning like it is doing something, it says it is on line 10, row 43 (whatever that means), so it appears to be still working. I stopped one of the Query Analyzers and noticed this message: "The name 'T' is not permitted in this context. Only constants, expressions, or variables allowed here. Column names are not permitted" One of the many lines that it began having issues with this is: insert into TABLENAME values(1,'AAVS','ANALYZER','S310','','357C','855','776493','DIG VID ANLZR CORE MOD','P','VOTE5WBKAA',207610,'207610--1','CO','','1','','1','S310','ADVANCED AUDIO VISUAL SYSTEMS',T); It appears that it does not much care for the 'T' at the end of each row. Is this required? Is there a way to take it out of the entire table before running it again? Is there a way to choose what information I want to populate? Currently the header script shows this: CREATE TABLE TABLENAME ( BCKEY Numeric, MFG Character(4), DWG Character(11), LIST Character(25), SERIES Character(6), FRC Character(5), ECN Character(3), CPR Character(6), DSC Character(22), EQTYPE Character(2), CLEI Character(10), ECI Numeric, BARCODE Character(9), OS Character(2), OFC Character(2), UC Character(2), FILLER Character(8), INDCODE Character(1), PN Character(25), EPN Character(39), DWGNN Logical); insert into TABLENAME values(1,'AAVS','ANALYZER','S310','','357C','855','776493','DIG VID ANLZR CORE MOD','P','VOTE5WBKAA',207610,'207610--1','CO','','1','','1','S310','ADVANCED AUDIO VISUAL SYSTEMS',T); What if I only want some of these fields? Is there a way to tell it that I only want: BCKEY, MFG, LIST, SERIES, DSC, EQTYPE, CLEI, PN & EPN? The rest I do not want, so can I take the rest out somehow? Thanks, ![]() |
|
#2
|
|||
|
|||
|
You just do
Insert into tablename(BCKEY, MFG, LIST, SERIES, DSC, EQTYPE, CLEI, PN , EPN) values( whatever values for the fields listed). You are done. Cheers ![]() |
|
#3
|
||||
|
||||
|
Yeah, change the insert statement like this:
INSERT INTO TABLENAME(BCKEY, MFG, LIST, SERIES, DSC, EQTYPE, CLEI, PN, EPN) VALUES ('val1', val2, 'val3'...) Bear in mind that the fields that you don't put in the above statement will be populated with NULL. If you don't want NULLs for the other fields, you might want to change the other fields in the CREATE TABLE statement to have a default value.
__________________
Up the Irons What Would Jimi Do? Smash amps. Burn guitar. Take the groupies home. "Death Before Dishonour, my Friends!!" - Bruce D ickinson, Iron Maiden Aug 20, 2005 @ OzzFest Down with Sharon Osbourne Puzzle of the Month solved by sizeablegrin, etienne141 and L7Sqr, superior C/C++ programmers of the month |
![]() |
| Viewing: Dev Shed Forums > Databases > MS SQL Development > Importing a table w/Query Analyzer-Question! |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|