| Author |
Topic |
|
marcusN
Starting Member
6 Posts |
Posted - 2004-11-03 : 01:37:17
|
| dear experthow can i use sql server 2k user defined function to do a convert from smallmoney data type into string on my reopt printing?i using crystal report v10 as my report tool and sql server 2ooo as my database designer.i do have the this conversation from currency to string module written in Visual FOXPRO before, is it just simply copy and paste into it and then it can perform the function as i assumed using in visual foxpro before? any suggestion on it or any misleadding pls let me know...thank you in advance |
|
|
dsdeming
479 Posts |
Posted - 2004-11-03 : 07:58:26
|
| You don't need a udf for this. Use the built-in CAST function:declare @test smallmoneyset @test = 11.23select @test, '$' + CAST( @test as varchar( 25 ))Dennis |
 |
|
|
jsmith8858
Dr. Cross Join
7423 Posts |
Posted - 2004-11-03 : 10:27:22
|
| do this in crystal not in T-SQL. Crystal has excellent formatting options.Why do people make things hard and overcomplicated ????????- Jeff |
 |
|
|
marcusN
Starting Member
6 Posts |
Posted - 2004-11-03 : 23:47:43
|
| well dsdeming,what if i just copy and paste into the user defined function, then in future how do call this function in my application written with ASP.NET?well jsmith8858i know what u mean by using Totext(()in CR to change the currency into string, but please consider my case is i need to conert the numeric into another language, which i need to disply 2 types of language in a row...including english.but anyhow, thanks for ur feedback...just show me some more hints and i can find my way back again |
 |
|
|
nr
SQLTeam MVY
12543 Posts |
Posted - 2004-11-04 : 05:35:28
|
| you call the udf from t-sqlselect dbo.fn_cnvmoney(myfld) from mytbl==========================================Cursors are useful if you don't know sql.DTS can be used in a similar way.Beer is not cold and it isn't fizzy. |
 |
|
|
jsmith8858
Dr. Cross Join
7423 Posts |
Posted - 2004-11-04 : 09:32:36
|
| give us an example of what you are looking for -- i don't know what you mean by converting a monetary value to multiple "languages". Different currency symbols and thousands separators?if SQL returns:12.45what do you need to do with this on your report? how would you like it to be displayed?- Jeff |
 |
|
|
X002548
Not Just a Number
15586 Posts |
Posted - 2004-11-04 : 10:30:24
|
quote: Originally posted by jsmith8858 Why do people make things hard and overcomplicated ????????
Why ask why?Hey the saux won already....you sure you're not a New Yorker...Yo! Marcus...post the FOXPRO Code...Brett8-) |
 |
|
|
marcusN
Starting Member
6 Posts |
Posted - 2004-11-04 : 20:50:02
|
| jsmith 8858,i am from malaysia (not a terrorist country here!!), so i suing this function is click the button then it can conert the numeric figure into 1. english , 2. malay (my national country)concept still the same, using len(),left(),right(), trunc() in order to filter the numeric position... |
 |
|
|
robvolk
Most Valuable Yak
15732 Posts |
Posted - 2004-11-04 : 21:39:53
|
| What are the English and Malay formats you need? Can you provide an example of both? I agree with everyone else in that you are much better off having Crystal format the numbers instead of doing them in SQL Server, and more easily as well. |
 |
|
|
|