| | |
Return a value from a Function
Please support our MS SQL advertiser: Intel Parallel Studio Home
Thread Solved |
Dear all,
Sorry, if this Thread is wrong room
.
I want to return a field value from a table, so I created a function like this :
but, I got this error :
Help me, what should I do?
Thanks
Sorry, if this Thread is wrong room
.I want to return a field value from a table, so I created a function like this :
MS SQL Syntax (Toggle Plain Text)
CREATE FUNCTION dbo.CheckStatusTrx(@TransNo Varchar(20)) RETURNS varchar(20) AS BEGIN DECLARE @Flag Numeric(1) SELECT @Flag = Flag, CreatedBy, ApprovedBy FROM TrxTD WHERE TransNo = @TransNo IF @Flag = 2 RETURN 'REJECTED' END
but, I got this error :
MS SQL Syntax (Toggle Plain Text)
Msg 141, Level 15, State 1, Procedure CheckStatusTrx, Line 6 A SELECT statement that assigns a value TO a variable must NOT be combined WITH data-retrieval operations.
Help me, what should I do?
Thanks
NEVER NEVER NEVER GIVE UP
•
•
Join Date: Jul 2009
Posts: 2
Reputation:
Solved Threads: 0
Hi
Actually this in the group of small errors consuming time
Just have aook on my blog
http://sqlerrormessages.blogspot.com...t-assigns.html
Happy Programming
Actually this in the group of small errors consuming time
Just have aook on my blog
http://sqlerrormessages.blogspot.com...t-assigns.html
Happy Programming
![]() |
Similar Threads
- What would you return for a string function? (C++)
- What's wrong with the return of this function call? (C++)
- Replacing return() function (PHP)
- unable to return values from function in c++ (C++)
- unable to return values from function in c++ (C++)
- hot to get a return value from a function executed by a pthread (C)
- return in an function (C)
- having a small problem with the gets function (C)
- How would i recode as a function? (Java)
Other Threads in the MS SQL Forum
- Previous Thread: Help with NOT using cursors
- Next Thread: print last row in datagrid from table.
| Thread Tools | Search this Thread |
autogrowth connectingtodatabaseinuse count cursor data database datepart dbsize deadlock delete_trigger highperformancecomputing hpc hpcserver2008 ibm iis loop maximum microsoft ms mssql multithreading news number permission query reporting result server services sets source sql sqlserver sqlserver2005 supercomputing uniqueid update view





