Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

optimize insert statement Expand / Collapse
Author
Message
Posted Tuesday, September 15, 2009 9:04 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Sunday, April 25, 2010 10:41 PM
Points: 4, Visits: 12
hi guys!

i want to hear some ideas from you. i'm performing an insert statement in this fashion:

insert into worktable
select A.column1

from table1 A
inner join table 2 B
on A.key = B.key
inner join table 2 C
on A.key = C.key
where A.key = 'something'

Post #788683
Posted Tuesday, September 15, 2009 10:56 PM


SSCommitted

SSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommitted

Group: General Forum Members
Last Login: Friday, April 04, 2014 9:22 PM
Points: 1,525, Visits: 4,070
That's not enough information for us to go off of. Are there any triggers on the table? Locking Contention possibly? We need a bit more information about your environment.

Seth Phelabaum
Consistency is only a virtue if you're not a screwup.

Links: How to Post Sample Data :: Running Totals :: Tally Table :: Cross Tabs/Pivots :: String Concatenation
Post #788697
Posted Wednesday, September 16, 2009 8:09 AM


SSCommitted

SSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommitted

Group: General Forum Members
Last Login: Wednesday, February 05, 2014 2:39 PM
Points: 1,564, Visits: 2,366
Carla, the first thing I see is that unless your table only has one column, if you don't supply the column name into which you would like to insert the values, you will get an error like this

Server: Msg 213, Level 16, State 4, Line 1
Insert Error: Column name or number of supplied values does not match table definition.



Greg
_________________________________________________________________________________________________
The glass is at one half capacity: nothing more, nothing less.
Post #788968
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse