MS SQL Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsDatabasesMS SQL Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
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  
Old June 28th, 2004, 03:51 PM
confuzed2xover confuzed2xover is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2004
Posts: 185 confuzed2xover User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 Day 5 h 45 m 53 sec
Reputation Power: 5
Question Importing a table w/Query Analyzer-Question!

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,

Reply With Quote
  #2  
Old June 29th, 2004, 04:15 PM
qqhq qqhq is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Posts: 8 qqhq User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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

Reply With Quote
  #3  
Old June 29th, 2004, 04:17 PM
Scorpions4ever's Avatar
Scorpions4ever Scorpions4ever is offline
Banned ;)
Dev Shed God 5th Plane (7000 - 7499 posts)
 
Join Date: Nov 2001
Location: Glendale, Los Angeles County, California, USA
Posts: 7,432 Scorpions4ever User rank is Major General (70000 - 90000 Reputation Level)Scorpions4ever User rank is Major General (70000 - 90000 Reputation Level)Scorpions4ever User rank is Major General (70000 - 90000 Reputation Level)Scorpions4ever User rank is Major General (70000 - 90000 Reputation Level)Scorpions4ever User rank is Major General (70000 - 90000 Reputation Level)Scorpions4ever User rank is Major General (70000 - 90000 Reputation Level)Scorpions4ever User rank is Major General (70000 - 90000 Reputation Level)Scorpions4ever User rank is Major General (70000 - 90000 Reputation Level)Scorpions4ever User rank is Major General (70000 - 90000 Reputation Level)Scorpions4ever User rank is Major General (70000 - 90000 Reputation Level)Scorpions4ever User rank is Major General (70000 - 90000 Reputation Level)Scorpions4ever User rank is Major General (70000 - 90000 Reputation Level)Scorpions4ever User rank is Major General (70000 - 90000 Reputation Level)Scorpions4ever User rank is Major General (70000 - 90000 Reputation Level) 
Time spent in forums: 4 Weeks 1 Day 22 h 29 m 51 sec
Reputation Power: 784
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

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesMS SQL Development > Importing a table w/Query Analyzer-Question!


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway