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 |
|
kavitaravi
Starting Member
2 Posts |
Posted - 2005-07-21 : 02:44:47
|
| Hi, I am trying to execute the following:Select * from ManagesUsers(Convert(varchar(30), user_name()))I get the following error "Incorrect syntax near the keyword 'Convert'"ManagesUsers is a SQL Server User defined function and accepts a varchar(30) input parameter.The following code works fine:Declare @USerID varchar(30)Select @USerID = (SELECT convert(char(30),user_name())) Select * from ManagesUsers(@USerID)But I need to pass it directly...any idea how to do it?Thanks.Kavita. |
|
|
jen
Master Smack Fu Yak Hacker
4110 Posts |
Posted - 2005-07-21 : 03:04:30
|
| use user instead of user_name()--editactually you need not convert the result from user_name(), i tried this and it's okcreate function dbo.fnTest(@user varchar(20))returns varchar(20)asbegin return @userendgoselect dbo.fntest(user_name())godrop function dbo.fntest--------------------keeping it simple... |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2005-07-21 : 04:14:03
|
| Alternatively you can try Select * from ManagesUsers((select user_name()))MadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|