If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > Microsoft SQL Server > Tried to Solve a Problem and i got bit

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 04-18-04, 01:20
Ruprect Ruprect is offline
12 Monkey Method
 
Join Date: Feb 2004
Location: San Antonio, TX
Posts: 565
Tried to Solve a Problem and i got bit

I was working on the thread "Call stored procedure within SELECT statement "

but a funny thing happend
i was going to suggest using a function instead of a proc but i cant seem to get it to run

create function dbo.Fitem(@item int)
Returns table
as
Return (select item, Result=(value * value) from tba
where item = @item)
GO

select dbo.Fitem(1)

then i get this

Server: Msg 208, Level 16, State 1, Line 1
Invalid object name 'dbo.Fitem'

am i just too tired or what?
Reply With Quote
  #2 (permalink)  
Old 04-18-04, 01:35
blindman blindman is offline
World Class Flame Warrior
 
Join Date: Jun 2003
Location: Ohio
Posts: 12,356
Well, for starters you do not need to preface table functions with the owner; just scalar functions.

Also, I believe you need a BEGIN and END statement in your function definition.

And yes, your syntax is off. Check Books Online for structure and examples.
__________________
If it's not practically useful, then it's practically useless.

blindman
www.chess.com: "sqlblindman"
www.LobsterShot.blogspot.com
Reply With Quote
  #3 (permalink)  
Old 04-18-04, 01:46
Ruprect Ruprect is offline
12 Monkey Method
 
Join Date: Feb 2004
Location: San Antonio, TX
Posts: 565
got it
just too tired
thanks for the in-depth help
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On