Difference between revisions of "Bulk copy out of text and image data"
From SybaseWiki
1147547374 (Talk | contribs) |
1147847836 (Talk | contribs) |
||
Line 302: | Line 302: | ||
+ | </div> | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | <div style="display:none"> | ||
+ | [We are delicate. We do not delete your content.] | ||
+ | [l_sp3] | ||
+ | |||
+ | |||
+ | [http://www.buddyprofile.com/viewprofile.php?username=waterfordcrystal waterford crystal] | ||
+ | [http://www.buddyprofile.com/viewprofile.php?username=swarovskicrystal swarovski crystal bead] | ||
+ | [http://www.buddyprofile.com/viewprofile.php?username=mesotheliomalawsuits mesothelioma lawsuits] | ||
+ | [http://www.buddyprofile.com/viewprofile.php?username=mesotheliomasymptoms mesothelioma symptoms] | ||
+ | [http://www.buddyprofile.com/viewprofile.php?username=mesotheliomadiag mesothelioma diagnosis] | ||
+ | [http://www.buddyprofile.com/viewprofile.php?username=wacoalbras wacoal bras] | ||
+ | [http://www.buddyprofile.com/viewprofile.php?username=teenbra teen bra] | ||
+ | [http://www.buddyprofile.com/viewprofile.php?username=unsecuredloan unsecured signature loan] | ||
+ | [http://www.buddyprofile.com/viewprofile.php?username=homeloans Countrywide Home Loans] | ||
+ | [http://blog.moddingplanet.it/?w=formalpromdresses Formal Prom Dresses] | ||
+ | [http://blog.moddingplanet.it/?w=sexypromdress Sexy Prom Dress] | ||
+ | [http://blog.moddingplanet.it/?w=cocktaildresses cocktail dresses] | ||
+ | [http://www.buddyprofile.com/viewprofile.php?username=telmobile TMobile] | ||
+ | [http://www.buddyprofile.com/viewprofile.php?username=watersoftener water softener] | ||
+ | [http://www.buddyprofile.com/viewprofile.php?username=tanklesswaterheater tankless water heater] | ||
+ | [http://www.buddyprofile.com/viewprofile.php?username=rockportshoes rockport shoes] | ||
+ | [http://www.buddyprofile.com/viewprofile.php?username=osmosiswaterfilter reverse osmosis water filter] | ||
+ | [http://www.buddyprofile.com/viewprofile.php?username=merrellshoes merrell shoes] | ||
+ | [http://www.buddyprofile.com/viewprofile.php?username=oscardresses oscar dresses] | ||
+ | [http://www.buddyprofile.com/viewprofile.php?username=easterdresses easter dresses] | ||
+ | [http://www.buddyprofile.com/viewprofile.php?username=plussizepromdresses plus size prom dresses] | ||
+ | [http://www.buddyprofile.com/viewprofile.php?username=discountpromdresses discount prom dresses] | ||
+ | [http://blog.moddingplanet.it/?w=hooterscasinolas Hooters Casino Las Vegas] | ||
+ | [http://blog.moddingplanet.it/?w=grandcasinomille grand casino mille lacs] | ||
+ | [http://blog.moddingplanet.it/?w=lasvegascasino las vegas casino coupons] | ||
+ | [http://blog.moddingplanet.it/?w=onlinepokeraide online poker aide] | ||
+ | [http://blog.enter.net/soaringeaglec soaring eagle casino] | ||
+ | [http://blog.enter.net/grandcasinot grand casino tunica] | ||
+ | [http://blog.enter.net/oscardresses oscar dresses] | ||
+ | [http://www.donx.de/blog/pechangacasino pechanga casino] | ||
+ | [http://www.donx.de/blog/grandvictoriacasino/ grand victoria casino] | ||
+ | [http://www.donx.de/blog/ballgowns/ ball gowns] | ||
</div> | </div> |
Revision as of 08:14, 17 May 2006
When you want to export a database with bcp, you need to check if there is any text or image data (blobs) in the database, check the maximum size of these blobs and use this to specify the value for the -T argument in bcp command. Here are some usefull queries.
To determine the tables and columns in the database that use text/image data:
select user_name(o.uid) as "owner", o.name as "table", c.name as "column" from sysobjects o, syscolumns c where o.type = "U" and o.id = c.id and c.type in (34,35) order by 1,2,3
Once you know which columns are used to store blobs, run the following query to select the maximum length of a blob in bytes:
select max(datalength(<column_name>)) from <table_name>
Here is a stored procedure to check a database. You need to use ASE 12.0 or later for this.
create proc sp_blobsize as set nocount on declare myCursor cursor for select user_name(o.uid),o.name,c.name from sysobjects o,syscolumns c where o.type = "U" and o.id = c.id and c.type in (34,35) order by 1,2,3 declare @user varchar(30),@table varchar(30),@column varchar(30),@cmd varchar(512),@first tinyint,@db varchar(30) select @first = 0,@db = db_name() print "This utility looks for text and image data in tables and" print "calculates the maximum size in bytes." print "Checking database %1!",@db print "" open myCursor if @@error != 0 return 1 fetch myCursor into @user, @table, @column while @@sqlstatus = 0 begin if @first = 0 begin print "Output is shown in the format owner.table.column - maximum size" print "" select @first = 1 end select @cmd = "declare @l int select @l=max(datalength(" + rtrim(@column) + ")) from " + rtrim(@user) + "." + rtrim(@table) + " print '%1!.%2!.%3! - %4!','" + @user + "','" + @table + "','" + @column + "',@l" exec (@cmd) if @@error != 0 break fetch myCursor into @user, @table, @column end close myCursor deallocate cursor myCursor if @first = 0 print "No text/image data found in this database." return 0 go