Author |
Topic |
bilencekic
Posting Yak Master
121 Posts |
Posted - 2006-01-08 : 10:26:53
|
ALTER PROCEDURE sp_Kullanici_KullaniciBilgiGetir@KullaniciAdi varchar(50),@Durum char(1)AS if @Durum = 1 begin Select ID from Oyuncular where KullaniciAdi = @KullaniciAdi end If @Durum = 2 begin Select * from Oyuncular end RETURN if @durum=2 it needs kullaniciAdi too but i want that if durum = 2 then select * from Oyuncular without requireing KullaniciAdihow to do it ?in both if it needs kullaniciAdi but i want it to need KullaniciAdi at firstMS BLESS US |
|
bilencekic
Posting Yak Master
121 Posts |
Posted - 2006-01-08 : 10:40:40
|
ok i solved i think.When i send KullaniciAdi as blankit gives me what i want.thxMS BLESS US |
|
|
blindman
Master Smack Fu Yak Hacker
2365 Posts |
Posted - 2006-01-08 : 11:57:14
|
quote: Originally posted by bilencekicALTER PROCEDURE sp_Kullanici_KullaniciBilgiGetir...
That is so cool. I am going to name my next stored procedure sp_Kullanici_KullaniciBilgiGetir just for the hell of it. |
|
|
spirit1
Cybernetic Yak Master
11752 Posts |
Posted - 2006-01-08 : 11:59:32
|
you're even geekier than i thought, bruce. [edit]bilencekic, don't prefix your stored procedures with sp_spProc is ok sp_proc isn't.if a sproc has a sp_ prefix the sql server first goes to the master db to look for it. so if by any chance you'd have sp_Kullanici_KullaniciBilgiGetir in your masterdb that one would get executed and not the one in your db.Bruce i agree though, it's a cool sproc name [/edit]Go with the flow & have fun! Else fight the flow |
|
|
Arnold Fribble
Yak-finder General
1961 Posts |
Posted - 2006-01-08 : 13:01:33
|
But surely the letter i in Kullanici should be dotless?...which reminds me... |
|
|
bilencekic
Posting Yak Master
121 Posts |
Posted - 2006-01-08 : 16:01:42
|
lol you mean it work slower by going to master?it works buti use sp_ with my all projectsMS BLESS US |
|
|
bilencekic
Posting Yak Master
121 Posts |
Posted - 2006-01-08 : 16:11:30
|
I didint get what you say ?My master db has same procsand my proc named with sp_ appears in my db no performance or other problem :D so what is the problem ? can u pls expalaiN?MS BLESS US |
|
|
blindman
Master Smack Fu Yak Hacker
2365 Posts |
Posted - 2006-01-08 : 19:21:33
|
The sproc will work if prefixe with sp_, but the server will first check to see if a sproc by that name exists in Master before looking in the current database. That slows things down.In general, though this is a hotly debated subject, the use of prefixes to describe objects is considered old-fashioned and is discuraged. This include sp_, tbl_, vw_, whatever. In principle that physical manifestation of objects should be separate from their logical purpose. The problem can become particularly evident with tables and views. Say you name your tables with tbl_ and then decide to modify your table, but to prevent breaking existing code you create a view based upon your new table to manifest data in the old format. Now you end up with a view prefixed by tbl_. Or you have a view that you decide to turn into a pre-aggregated table. Are you going to leave the new table's name prefixed with vw_? |
|
|
bilencekic
Posting Yak Master
121 Posts |
Posted - 2006-01-08 : 20:16:55
|
ok comrade :D i get it.MS BLESS US |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
|
|