Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
jamios28
Starting Member
18 Posts |
Posted - 2005-03-30 : 10:59:19
|
just wanted ur thoughts and do i need a begin at the start of each if?thx==============================================================CREATE FUNCTION dbo.CurrencyConvert(@StartCurrency Char, @Subtotal Real,@DateDelivered DateTime) RETURNS Real As BEGIN DECLARE @Result Real , @DateTemp DateTime, @ExRate real Set @DateTemp = @DateDelivered WHILE (SELECT DateTx FROM Exchange WHERE Exchange.DateTx = @DateTemp) = 0 BEGIN Set @DateTemp = @DateTemp + 1 ENDSELECT ExchRate2 from Exchange WHERE Exchange.DateTx = @DateTempSet @ExRate= ExchRate2IF CharIndex(@StartCurrency, 'USD') <> 0 SET @Result = @Subtotal * @ExRateELSE SET @Result = @SubtotalRETURN @Resultend |
|
nr
SQLTeam MVY
12543 Posts |
Posted - 2005-03-30 : 11:00:59
|
no, only if you have more than one statement - but it's clearer if you do.==========================================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 - 2005-03-30 : 15:45:06
|
A little constructive critism/advice: I know you mentioned you are young and you have just started your first job after college, but try to use proper english (more or less) in your questions and posts in forums such as these to be taken seriously. Abbreviations like "ur" and "any1" label you as a script kiddie or an AOL chatter, whether that's accurate or not ... especially in email correspondence at work or technical documentation/notes.No self-respecting real programmer uses "kewl h4ck3r" lingo like that ... (I actually just learned what "l33t" means just a few weeks ago !)- Jeff |
|
|
|
|
|