Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

string vs memo for a SQL Server UDF field

Status
Not open for further replies.

Hubajube

Programmer
Mar 6, 2002
25
US
I'm having a problem similar to the person with the Excel string/memo problem. I have a SQL Server query that contains a field that's assigned a return value of a UDF. The value of the UDF can be a string up to 254 characters long. I have two identical copies of this query and UDF in two different databases. When I link to database #1, Crystal assigns the field a type of String[255]. When I link to database #2, Crystal assigns the field a type of Memo.

How does Crystal decide how large the string can be? I'm not even sure why it's decided on String[255] instead of String[254]. I changed the UDF to return Left(Value,10) instead of simply Value, and Crystal doesn't seem to realize that there's a difference.

Any ideas?
 
OK, here's something weird. I changed to view to return LEFT(Value, 100) instead of just Value and now Crystal is showing String[200]. Hmmmmmm
 
Hint #2. I changed the UDF to return varchar(254) instead of nvarchar(254) and Crystal is now catching that it's 254 long. The problem is that the other database was returning nvarchar also, but still caused Crystal to recognize that it's a String(254). What could be different between the two?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top