Showing posts with label database. Show all posts
Showing posts with label database. Show all posts

February 28, 2012

Dump a single table to a file in mysql.

For some reason I always find myself searching for a way to dump a single temp table out of mysql.

Backup a single table from the database:
mysqldump -u -p database_one table_name > /var/www/backups/table_name.sql

Restore the table into another database:
mysql -u -p database_two < /var/www/backups/table_name.sql

August 3, 2007

Microsoft Access 2007 MS_WSSTemplateID bug

Strange error when trying to use a subform inside an Access form to the effect of:

SELECT*,sql_variant_property(value,'basetype') AS type FROM
::fn-listextendedproperty(N'MS_WSSTemplateID',N'user,N'dbo',N'table,N'tblCas
eInfo',NULL,NULL)


FIX:
Try to minimize the ribbon.
If the ribbon is minimized Access12 doesn't send the bugged query. Makes no sense, but works.

September 27, 2005

Installing and using MythTV: Checking prerequisites.

You must ensure that any firewalls (either hardware, or a software firewall installed by your distribution) will not block access to the ports that will be used by the MythTV clients and servers on the "inside" LAN. The ports for MySQL (TCP port 3306) and mythbackend (TCP ports 6543 and 6544) must be open. It is strongly recommended that you do not expose the MythTV and MySQL ports to the Internet or your "Outside" LAN.

December 6, 2004

Using ColdFusion to work with SQL binary data

<CFSET FileName = "HotDogVendor.jpg">
<CFFILE ACTION="readbinary" FILE="D:\WebFiles\MyWebsite\Images\Postcards\#FileName#" VARIABLE="NEWDATA">

<cfset NewObject = toBinary(NEWDATA)>

<cfquery name="insertImage" datasource="MyDatasource" username="myusername" password="mypassword">
update images
set content = <CFQUERYPARAM VALUE="#NewObject#" CFSQLType="CF_SQL_BLOB">
where NAME = '#FileName#'
</cfquery>

...And now, how to output an image, which is stored in a SQL Server table as an image data type? Here is code which I found on another forum that appears to work (but still not the perfect solution):

<cfquery name="GetImage" datasource="MyDatasource" username="myusername" password="mypassword">
select content
from Images
where NAME = '#FileName#'
</cfquery>

<cfcontent type="image/gif; charset=8859_1">

<CFSCRIPT>
writeOutput(toString(GetImage.Content));
</cfscript>