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.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 SP If statement

Author  Topic 

cipriani1984
Constraint Violating Yak Guru

304 Posts

Posted - 2009-10-15 : 12:19:50
Hi,

Im trying to do the following in a stored procedure, i have a parameter and based on that input depends on which temp tables are created and used in a report.

example:

create proc dbo.proc1

@style varchar(max)

as

if (@style = 'Units')

create table table1(Product varchar(max), Units float)

ELSE

create table table1(Product varchar(max), NetRev float)

But its giving me error at the else part just says inccorect syntax near...etc

Any ideas?

Thanks

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2009-10-15 : 12:31:05
I have tried and there is no error...


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page

cipriani1984
Constraint Violating Yak Guru

304 Posts

Posted - 2009-10-15 : 12:33:28
Can a SP have too many arguements? parameters?

quote:
Originally posted by webfred

I have tried and there is no error...


No, you're never too old to Yak'n'Roll if you're too young to die.

Go to Top of Page

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2009-10-15 : 12:41:44
I don't think so.


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page

Lamprey
Master Smack Fu Yak Hacker

4614 Posts

Posted - 2009-10-15 : 14:43:24
That max number of parameters is 2100.
Go to Top of Page
   

- Advertisement -