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 |
chasingvertigo
Starting Member
5 Posts |
Posted - 2012-12-18 : 16:31:13
|
I'm writing a deployment script that I would very much prefer stay as one query, however this is causing an issue when ran.Here's what I have:Function FunctionName has one parameter. I run this:ALTER FUNCTION dbo.FunctionName(p1 int, p2 int) returns BIT AS BEGIN RETURN 1ENDGOSELECT [dbo].[FunctionName] (1,2) This gives the following error:Procedure or function dbo.FunctionName has too many arguments specified. It appears to be evaluating whether the select will work before doing the alter. Running these as separate queries works fine. Does anyone know how to make the above work in one query? |
|
Bustaz Kool
Master Smack Fu Yak Hacker
1834 Posts |
Posted - 2012-12-18 : 19:34:09
|
Could not reproduce:[CODE]--- Ran this firstcreate function dbo.Junk(@x int)returns intasbeginreturn @x;endgo--- Ran from here down in SSMSalter function dbo.Junk(@x int, @y int)returns intasbeginreturn @x + @y;endgoselect dbo.Junk(1, 2);godrop function dbo.Junk;[/CODE]Runs fine in SSMS. No errors; no warnings. Are you missing the '@' as the initial character in the function parameters?=================================================Hear the sledges with the bells - silver bells! What a world of merriment their melody foretells! |
 |
|
|
|
|