﻿<?xml version='1.0' encoding='UTF-8'?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>SQLServerCentral / SQL Server 2008 / SQL Server 2008 - General  / Calling Scalar Function within stored Procedure / Latest Posts</title><generator>InstantForum.NET v2.9.0</generator><description>SQLServerCentral</description><link>http://www.sqlservercentral.com/Forums/</link><webMaster>notifications@sqlservercentral.com</webMaster><lastBuildDate>Wed, 22 May 2013 04:46:06 GMT</lastBuildDate><ttl>20</ttl><item><title>RE: Calling Scalar Function within stored Procedure</title><link>http://www.sqlservercentral.com/Forums/Topic1043856-391-1.aspx</link><description>[quote][b]mandavli (1/6/2011)[/b][hr]begin    declare @setval as integer    set @setVal = getCalcvalue(@value1,@value2)--    based on value i receive from function  there are fuether select statements[/quote]How about:[code]SELECT @setVal = dbo.getCalcvalue(@value1,@value2)[/code]CEWII</description><pubDate>Thu, 06 Jan 2011 12:21:20 GMT</pubDate><dc:creator>Elliott Whitlow</dc:creator></item><item><title>RE: Calling Scalar Function within stored Procedure</title><link>http://www.sqlservercentral.com/Forums/Topic1043856-391-1.aspx</link><description>Here is my function and stored procedureCreate Function getCalcvalue(@Param1 as integer,@Param2 as integer ) returns integerBegindeclare @setVal as integer-- select techVal from Pt101Tbl where col1 = @param1 and col3 = @param2  set @setval  =  ---calculations based on techVal   return @setValEndALTER PROCEDURE [dbo].[sp1]@value1 as integer,@value2 as integer,@value3 as integer  ASbegin    declare @setval as integer    set @setVal = getCalcvalue(@value1,@value2)--    based on value i receive from function  there are fuether select statementsEnd</description><pubDate>Thu, 06 Jan 2011 10:09:23 GMT</pubDate><dc:creator>mandavli</dc:creator></item><item><title>RE: Calling Scalar Function within stored Procedure</title><link>http://www.sqlservercentral.com/Forums/Topic1043856-391-1.aspx</link><description>we'd really need the exact error you are getting...and also the exact code you are doing to really help. All i can offere is generalities.where is param1 and param2? are they fields, or locally declared variables inside the proc?[code]CREATE PROC myProc ASBEGINdeclare @Param1 intDeclare @Param2 int'assign values to variables inside the proc?select @Param1 = object_id,@Param2 = colid from sys.columns where object_name(object_id)= 'myTable'declare @selVal as integerset @selVal = select dbogetCalcvalue(@Param1,@Param2)--do more stuffEND[/code]</description><pubDate>Thu, 06 Jan 2011 09:58:46 GMT</pubDate><dc:creator>Lowell</dc:creator></item><item><title>Calling Scalar Function within stored Procedure</title><link>http://www.sqlservercentral.com/Forums/Topic1043856-391-1.aspx</link><description>I have written scalar function named getCalcvalue that accepts 2 parameters and returns one parameters.Now I want to call this from stored procedure.so I have statement declare @selVal as integerset @selVal = select getCalcvalue(param1,param2)but I get error  'getCalcvalue' is not a recognized built-in function name.So I tried set @selVal = select dbo.getCalcvalue(param1,param2)Then also I get error How do I call this fuction correctly</description><pubDate>Thu, 06 Jan 2011 09:36:50 GMT</pubDate><dc:creator>mandavli</dc:creator></item></channel></rss>