[Microsoft][ODBC SQL Server Driver]String data, right truncation (SQL-01004)

February 10, 2010

Error: [Microsoft][ODBC SQL Server Driver]String data, right truncation (SQL-01004)

while running a perl DBI against MS SQL Server 2008.

Cause: unknown. But the field data size might be relevant (for example, incorrect sampling/guessing of the field size by the ODBC).

Fix: Exclude the field from the query.


function sequence error

December 2, 2009

function sequence error

This was from SQL Server 2000. This was actually a data truncation problem for me, and apparently for some other people too. If you see this error, check all data sizes whether anything would not fit into the destination field size. How deceiving – the message is.

Solution: Check each field size. Make sure the destination field size is at least the size of the data to insert.


protect websvn folder with .htaccess

October 6, 2009

It goes without saying, but the websvn documentation gives an impression that .htaccess is the wrong solution.

But, it “might be wrong” for advanced uses – the documentation says it is wrong – “if you want to restrict access per branch of the repository.”

But for a simple user like me, it works. All I have to do is add a .htaccess file in the websvn folder, and set config.php correctly.


Cannot rename the table because it is published for replication.

October 6, 2009

There is a authentic column on Sql Server Central about changing metadata of a replicated database.

Altering a column on a Replicated Table

http://www.sqlservercentral.com/articles/Replication/alteringacolumnonareplicatedtable/1666/

However, I was searching for a simpler answer.

Although it doesn’t necessarily say it explicitly, I got a hint from this page.

http://msdn.microsoft.com/en-us/library/ms151870.aspx

The answer is simply, unless there are dependent objects,

1. add a new column

2. update the new column with values of the old column

3. drop the old column


Table ‘mysql.servers’ doesn’t exist

September 12, 2009

Problem: mysql.servers table is missing: flush privileges gives “Table ‘mysql.servers’ doesn’t exist”

Not sure why this happened…

Fix:

\u mysql

CREATE TABLE `servers` (
`Server_name` char(64) NOT NULL,
`Host` char(64) NOT NULL,
`Db` char(64) NOT NULL,
`Username` char(64) NOT NULL,
`Password` char(64) NOT NULL,
`Port` int(4) DEFAULT NULL,
`Socket` char(64) DEFAULT NULL,
`Wrapper` char(64) NOT NULL,
`Owner` char(64) NOT NULL,

PRIMARY KEY (`Server_name`)

) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT=’MySQL Foreign Servers table’;

source:

http://forums.mysql.com/read.php?11,142598,160503#msg-160503


Cannot fetch a row from OLE DB provider “BULK” for linked server “(null)”

August 13, 2009

[Bulk Insert Task] Error: An error occurred with the following error message: “Cannot fetch a row from OLE DB provider “BULK” for linked server “(null)”.The OLE DB provider “BULK” for linked server “(null)” reported an error. The provider did not give any information about the error.Bulk load: An unexpected end of file was encountered in the data file.”.

This was, from…

Wrong setting of ColumnDelimiter= tab when actually it was ColumnDelimiter= comma.

Splendid. Excellent error message.

It’s much easier this way:

1. Create a Data flow task.

2. Use Excel source. Map the names so it matches the destination column name.

- Keep null.

- Adjust maximum length and column type. (Excel driver is lazy.) String is 255 long and columns beginning with number becomes int. For example, (1,2,…,8a, 8b,… ) is assumed as an “int” field.

3. Use oledb destination.

4. Run. It will be in nvarchar and ntext, all over.

5. Run sql scripts – Just do alter table alter column. It’s simpler and easier.

:nvarchar to varchar:    Alter table xxx alter column yyy varchar(500)

:ntext to varchar:           Alter table xxx alter column yyy varchar(1500)


Using CIFS mount as documentroot for Apache (vhost)

August 5, 2009

If you use a cifs mount as the documentRoot for the apache server, you will see that the files are not served by Apache. You get blank pages.

The fix is EnableSendfile Off !

http://httpd.apache.org/docs/2.0/mod/core.html#enablesendfile

EnableSendfile Off

If SELINUX is needed, we need to add context.

The mount script will look like this

mount -t cifs -ouser=USER,password=PASS,ip=xxx.xxx.xxx.xxx,rw,file_mode=0664,dir_mode=0775,uid=xx,gid=xx ,context=system_u:object_r:httpd_sys_content_t:s0 //WINDOWS_SERVER/SHARE /local/mount/point

Not sure but this may also be needed to reset the SELINUX context

fixfiles relabel /local/mount/point


awk, substr, match

July 29, 2009

grep ‘\$Id’ *|awk ‘{print substr($0,(match($0,”Id”))-1,9)}’


pg: CHECK (column = tolower(column))

July 28, 2009

CHECK (column::bpchar ~ ‘^[a-z]+$’::bpchar::text)

CHECK (column = lower(column))


mysql ERROR 1016 (HY000): Can’t open file: ‘….MYI’ (errno: 145)

July 27, 2009

The database file is corrupt.

mysql ERROR 1016 (HY000): Can’t open file: ‘….MYI’ (errno: 145)

It can be repaired.

mysqlcheck -r -p dbname tablename

ref: http://www.databasejournal.com/features/mysql/article.php/10897_3300511_2/Repairing-Database-Corruption-in-MySQL.htm


Follow

Get every new post delivered to your Inbox.