[freetds] truncated data from query

Ken Tozier kentozier at comcast.net
Wed Oct 4 02:32:35 EDT 2006


Hi

I ran through a similar problem a few months back (on a Mac) It turns  
out that you need to define one of the MSSQL records in "/usr/local/ 
etc/freetds.conf" (may be in a different location for Linux) to use  
TDS 8.x

For example:

# A typical Microsoft SQL Server 2000 configuration
[YourNameForTheServerHere]
	host = ntmachine.domain.com
	port = 1433
	tds version = 8.0

And use it in your connections like this (from PHP)

// Connect to the database
$db_connection = mssql_connect('YourNameForTheServerHere',  
'user','password')
			or die('Could not connect to database'));
				
// Depending on how permissions on the MSSQL database were set up,
// you may or may not have to explicitly select it
mssql_select_db('some_db_name')
		or die('Could not select some_db_name database');
		
// And in the next line it is VERY important that you include
// "$db_connection" in the query otherwise it won't work with MSSQL
// This is different from MySQL where "$db_connection" is optional.
$query_result 	= mssql_query($query, $db_connection)
		or die('Query failed: '.$query);

HTH

Ken


On Oct 3, 2006, at 10:54 PM, robert lazarski wrote:

> Hi all,
>
> I'm running freetds-0.65.dev.20060930 with unixODBC 2.2.11 with mssql
> 9 on linux. I have no idea what the cause of this is, but each
> generated line is truncating at exactly 303 char's . Here's an
> example:
>
> | INSERT [dbo].[MockAssetScenario]
> ([created],[probability],[modifiedUserFullName],[ticker], 
> [createdUserID],[assetScenarioID],[notes],[priceTarget], 
> [scenarioName],[modifiedUserID],[date],[version],[modified], 
> [includeScenario],[assetID],[createdUserFullName])VALUES(NULL, 
> 50,'','JPM',NULL,96,'Increased
> F|
>
> Note how it stops at 'Increased F|'
>
> I'm very close to achieving my goal, just have this last hurdle.  
> Please help.
>
> Robert
> _______________________________________________
> FreeTDS mailing list
> FreeTDS at lists.ibiblio.org
> http://lists.ibiblio.org/mailman/listinfo/freetds



More information about the FreeTDS mailing list