>One more question on the varbinary column/field in the SQL Server
>
>If I want the default of the varbinary field to be empty but not null, would the value of 0 (zero) be the right type of default? That is, when a user retrieves the value in the varbinary field and cast it to a char type, the result is an empty string (of course if there was never a value set in the field).
>
>TIA
Dmitry,
On the SQL Server side, you should use 0x, which is the equivalent of VFP's 0h (the representation of an empty binary string).
Let m.ODBC be an active connection handle to your server:
CURSORSETPROP("MapBinary",.T.,0)
LOCAL SQLStmt AS String
TEXT TO m.SQLStmt NOSHOW
DECLARE @Tmp TABLE (Col1 Int, Col2 Varbinary(10) not null default 0x);
insert into @Tmp (Col1) values (1);
insert into @Tmp (Col1, Col2) values (2, 0xffff);
select * from @Tmp;
ENDTEXT
SQLEXEC(m.ODBC, m.SQLStmt, "curResult")
SELECT *, LEN(Col2) FROM curResult INTO CURSOR curInspect
BROWSE
The result will be as you can see in the attached image,
----------------------------------
António Tavares Lopes