In SQL Server, you can write a user-defined scalar function called CStr() that performs the conversion.
Built-in routines are incompatible.
Unfortunately, this will not work because you need the prefix of the all function with the name of the schema. So you can:
create function cstr(@val int) returns varchar(255) as begin return(cast(@val as varchar(255))) end;
But you should call it like:
select dbo.cstr(4);
If the value is in a column, consider writing a view to a table in each database that performs the conversion in the view.
To get VB to work with both Access and SQL Server, you could simply refuse access and use a real database. Oh, I think this is not a solution;) You will need to determine the type of database and have a different code for each. You can minimize this by using representations to hide some deformities.
You might find it beneficial to upgrade to SQL Server 2012, which has expanded its repertoire of features to include some access features. But not CStr() .
Gordon linoff
source share