Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SQL Server numeric data type conversion
Message
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Client/server
Title:
SQL Server numeric data type conversion
Miscellaneous
Thread ID:
00833234
Message ID:
00833234
Views:
52
All:

Can someone tell me why the precision of a SQL Server numeric/decimal data type will always be two larger in a SPT results cursor in VFP?

For example going to the SQL Server pubs!discounts table:
LOCAL hConn, cConnectStr, nResult

hConn = 0
cConnectStr	= "DRIVER=SQL SERVER;SERVER=(local);UID=SA;PWD=;DATABASE=pubs"

hConn = SQLSTRINGCONNECT(m.cConnectStr)

IF hConn > 0
	nResult = SQLEXEC(m.hConn,"SELECT * FROM discounts")
	IF nResult > 0
		CLEAR
		DISPLAY STRU
	ENDIF 
	=SQLDISCONNECT(hConn)
ELSE
	= MESSAGEBOX("Connect Failed!")
ENDIF
The DISCOUNT field is defined as precision = 4 and scale = 2 in SQL Server. However, in the sqlresults cursor the DISCOUNT field has width = 6 and dec = 2.

--Paul
Next
Reply
Map
View

Click here to load this message in the networking platform