Mombu the Microsoft Forum sponsored links

Go Back   Mombu the Microsoft Forum > Microsoft > SQL SERVER (TECHNET) > Fast load options in OpenRowset
User Name
Password
REGISTER NOW! Mark Forums Read

sponsored links


Reply
 
1 7th August 05:24
mweekslzkr
External User
 
Posts: 1
Default Fast load options in OpenRowset


I'm loading data that's already in primary key order to a large existing
table. I hoped to exploit the SSPROP_FASTLOADOPTIONS. About all I can find
on MSDN is "This property is the same as the -h "hint[,...n]" option of the
bcp utility". If I use any of the do***ented hints I get an error in the
dwStatus property field. e.g. a simple "TABLOCK"...

RFLProperties[0].dwOptions = DBPROPOPTIONS_REQUIRED;
RFLProperties[0].colid = DB_NULLID;
RFLProperties[0].dwStatus = DBPROPSTATUS_OK;
RFLProperties[0].dwPropertyID = SSPROP_FASTLOADOPTIONS;
RFLProperties[0].vValue.vt = VT_BSTR;
RFLProperties[0].vValue.bstrVal = SysAllocString ( L"TABLOCK" );
RFLPropSet[0].guidPropertySet = DBPROPSET_ROWSET;
RFLPropSet[0].cProperties = 1;
RFLPropSet[0].rgProperties = RFLProperties;
hr = pIOpenRowsetFL->OpenRowset ( NULL, &TableID, NULL,
IID_IRowsetFastLoad, 1, RFLPropSet,
(LPUNKNOWN *)&pIFastLoad );

The program runs fine if I OpenRowset with zero properties and a NULL
property set. I've tried "HINT TABLOCK" but that's not right either.
Anybody, what am I doing wrong? Thanks.
  Reply With Quote


  sponsored links


2 7th August 05:24
erland sommarskog
External User
 
Posts: 1
Default Fast load options in OpenRowset


mweeks (mweeks@discussions.microsoft.com) writes:

Just a check, you are running VariantInit on RFLProperties[0].vValue,
aren't you?


--
Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx
  Reply With Quote
3 7th August 05:24
mweekslzkr
External User
 
Posts: 1
Default Fast load options in OpenRowset


Thanks for the speedy reply. No I wasn't; I thought that I wouldn't need to
since I'm setting vValue.vt and vValue.bstrVal - wouldn't VariantInit just
set the variant to VT_EMPTY which I am then replacing? I'm sorry, I'm very
green at this. I just added VariantInit ( &RFLProperties[0].vValue ) to the
code but I'm still getting DB_E_ERRORSOCCURRED.
  Reply With Quote
4 7th August 06:08
erland sommarskog
External User
 
Posts: 1
Default Fast load options in OpenRowset


mweeks (mweeks@discussions.microsoft.com) writes:


I may recall wrong, but I believe that I have made the same assumption -
and errors occurred?

Did you set the data source property SSPROP_ENABLEFASTLOAD?

I recommend studying the SQL Server Books Online. The specifics for
SQLOLEDB are covered there, including the bulk-copy stuff.

Also, download the samples from
http://www.microsoft.com/downloads/details.aspx?FamilyID=7824ba50-3e29-45cf-8c02-5597c014a707&DisplayLang=en
I believe there is a bulk-copy sample there.

--
Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx
  Reply With Quote
5 7th August 06:09
mweekslzkr
External User
 
Posts: 1
Default Fast load options in OpenRowset


Thanks again Erland,
Yes I did. As I said, the prog and FastLoad all work fine - it's just
setting the options. I can find no example, MSDN or Google where anyone is
doing this, a first for me.
  Reply With Quote
6 7th August 07:36
erland sommarskog
External User
 
Posts: 1
Default Fast load options in OpenRowset


mweeks (mweeks@discussions.microsoft.com) writes:


Alas, I'm out of ideas. You can investigate what RFLProperties[0].dwStatus
get set to, although it may not make you much wiser.

--
Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se

Books Online
for SQL Server 2005 at
http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx
  Reply With Quote


  sponsored links


Reply


Thread Tools
Display Modes




Copyright 2006 SmartyDevil.com - Dies Mies Jeschet Boenedoesef Douvema Enitemaus -
666