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 |
|
ghost7
Starting Member
3 Posts |
Posted - 2011-04-08 : 06:06:47
|
| Hi allI have big problem with creating a view with Table-valued function.Function:create FUNCTION [dbo].[GetValue]()RETURNS @tab TABLE (jid uniqueidentifier)ASbegininsert into @tab SELECT JID FROM dbo.Contacts WHERE user = suser_sname() returnendWhen I use the ADD table wizard and ADD the function to the view it puts this statement into sql:SELECT jid FROM dbo.GetValue(,) AS GetValue_1When I execute the sql it returns an error:Incorrect syntax near ','andIncorrect syntax near ')'Can U please help me??? I need to have a view, because other applications will collect the data. I spend many hours searching for this, but no solution found.Thanks in advanceGhost7 |
|
|
sunitabeck
Master Smack Fu Yak Hacker
5155 Posts |
Posted - 2011-04-08 : 07:17:58
|
Looks like you have an extra comma that is causing the problem.SELECT jid FROM dbo.GetValue(,) AS GetValue_1 Remove the comma from within the brackets. |
 |
|
|
ghost7
Starting Member
3 Posts |
Posted - 2011-04-08 : 08:04:01
|
| thx for replyBut I already tried it and SQL puts it back automatically with an error:Incorrect syntax near ')',already tried to add some parameters, but nothing is working.I tried to search for some examples but I havent find anything.I dont know why the SQL automatically rewrites my statement. In New Query works everything fine, but in the views designer it doesnt work.I tried almost everything...I am using SQLExpress 2008 with default instance.Maybe in full SQL (enterprise, standard) it will work, but I dont have them right now...Thx for any advice |
 |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2011-04-08 : 08:09:03
|
If possible then create your view in a normal query editor window without using that designer. No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
|
ghost7
Starting Member
3 Posts |
Posted - 2011-04-08 : 08:15:40
|
| Hi to allThx for all replies, Reinstalled sql and I have created new view and everything seems to work..thx again |
 |
|
|
|
|
|
|
|