تبلیغات
آموزش SQL - FUNCTIONS
 
آموزش SQL
الان میجنبم! فردا برای جنبیدن دیر است!!!
درباره وبلاگ


این وبلاگ زیر نظر مهندس یوسفی فرد مدیر گروه رشته کامپیوتر دانشگاه تمیشان بهشهر می باشد. در این وبلاگ مطالب آموزشی مربوط به درس SQL Server را قرار داده ام . امید است که مورد توجه شما کاربران عزیز قرار گیرد.

مدیر وبلاگ : Elham Sarfaraz
نویسندگان
آمار وبلاگ
  • کل بازدید :
  • بازدید امروز :
  • بازدید دیروز :
  • بازدید این ماه :
  • بازدید ماه قبل :
  • تعداد نویسندگان :
  • تعداد کل پست ها :
  • آخرین بازدید :
  • آخرین بروز رسانی :

FUNCTIONS :

ساختار کلی دستور ایجاد تابع:

CREATE FUNCTION  <fn_name>

  (

              <parameter_list>

 

)

RETURNS <retun_type>

AS

BEGIN

        

   <T_sql Statements>

       

RETURN <return_value>

END


مثال: تابعی تعریف كنید كه 2 عدد بگیرد و آن دو را در هم ضرب كند و مقدار آن را برگرداند.

CREATE  FUNCTION  Mul

(

     @a int,

     @b int

)

RETURNS bigint

AS

BEGIN

          DECLARE @r  bigint

          SET  @r=@a*@b

                        RETURN @r

END

SELECT  DBO.Mul   (3,5)  AS   ZARB

استفاده از تابع در SQL:

مثال:
ستونی به نام ضرب ایجاد کنید كه ستون های ID,Age را در هم ضرب كند.

SELECT

    ID,

    Firstname,

    Lastname,

Age   

DBO.Mul (ID,Age)  AS  ZARB

FROM

       Student

 

CREATE  FUNCTION  Mul

(

     @a int,

     @b int

)

RETURNS bigint

AS

BEGIN

          DECLARE @r  bigint

          SET  @r = @a * @b

                        RETURN @r

END

 

e.g)

SELECT  DBO.Mul   (3,8)  AS   ZARB

SELECT

    ID,

    Firstname,

    Lastname,

Age   

DBO.Mul (ID,Age)  AS  ZARB

FROM

       Student






نوع مطلب :
برچسب ها :
لینک های مرتبط :

       نظرات
جمعه 8 دی 1391
Elham Sarfaraz
سه شنبه 25 دی 1397 08:45 ب.ظ
Hello colleagues, pleasant piece of writing and pleasant arguments commented here, I am
genuinely enjoying by these.
دوشنبه 17 دی 1397 04:55 ب.ظ
This is very fascinating, You are an excessively professional blogger.
I have joined your rss feed and sit up for in search of extra of your great post.

Additionally, I've shared your website in my social networks
جمعه 7 دی 1397 02:09 ق.ظ
I read this paragraph completely on the topic of the resemblance of most
recent and preceding technologies, it's remarkable article.
پنجشنبه 6 دی 1397 10:23 ب.ظ
Your mode of explaining all in this post is truly pleasant, every one be capable of
simply be aware of it, Thanks a lot.
پنجشنبه 6 دی 1397 06:05 ب.ظ
Hi there, this weekend is pleasant for me, as this moment i am reading this impressive
educational piece of writing here at my home.
دوشنبه 3 دی 1397 08:13 ب.ظ
I have been browsing on-line greater than 3 hours today, but
I never found any attention-grabbing article like yours.
It's lovely price enough for me. In my view, if all site owners and bloggers made
excellent content material as you probably did, the internet might be
much more helpful than ever before.
یکشنبه 2 دی 1397 04:14 ق.ظ
Truly no matter if someone doesn't be aware of after that
its up to other visitors that they will assist, so
here it occurs.
جمعه 30 آذر 1397 03:01 ب.ظ
Good day! I simply wish to offer you a big thumbs
up for the great information you have here on this post.
I am returning to your site for more soon.
جمعه 23 آذر 1397 11:19 ق.ظ
It's remarkable to go to see this website and reading the views of all friends regarding
this post, while I am also eager of getting familiarity.
پنجشنبه 22 آذر 1397 09:18 ق.ظ
This desig is spectacular!You obviously know
howw to keep a reader amused. Between your wit and your
videos, I waas almost movedd to start my oown blog
(well, almost...HaHa!) Great job. I really enjoyed what you had to say, and
more than that, how you presented it. Too cool!
چهارشنبه 21 آذر 1397 12:09 ق.ظ
Hello! I know this iss kinda offf topic but I was wondering which blog platform
are you using ffor this website? I'm getting fed up oof Wordpress because
I've had problems with hackers and I'm looking at options
for another platform. I would be great if you could pointt me in the
direction of a good platform.
دوشنبه 19 آذر 1397 04:17 ب.ظ
Right here is the perfect webpage for anybody who wishes to understand this
topic. You know so mufh its almost tough to argue with you (not that I really would wantt to…HaHa).
You definitely put a fresh spin on a topic that'sbeen discussed for a
long time. Wonderful stuff, just wonderful!
پنجشنبه 15 آذر 1397 11:49 ب.ظ

Very good write ups. Regards.
click here to buy cialis generic cialis tadalafil weblink price cialis dosagem ideal cialis cialis sicuro in linea only now cialis 20 mg cialis purchasing costo in farmacia cialis cialis 20mg preis cf cialis 5mg prix
پنجشنبه 15 آذر 1397 02:24 ب.ظ
Thanks for sharing your thoughts on FUNCTIONS. Regards
پنجشنبه 15 آذر 1397 04:20 ق.ظ

This is nicely expressed! !
we choice cialis pfizer india cialis dose 30mg cialis bula cialis coupons cialis taglich cialis prezzo al pubblico cialis sans ordonnance trusted tabled cialis softabs the best site cialis tablets where cheapest cialis
چهارشنبه 14 آذر 1397 11:27 ب.ظ
It's hard to come bby knowledgeable people about this subject,
but you sound like you know what you're twlking about!
Thanks
سه شنبه 13 آذر 1397 12:21 ب.ظ

Amazing all kinds of amazing tips.
cheap cialis cost of cialis cvs look here cialis order on line cialis from canada cialis canada on line sialis cialis rckenschmerzen achat cialis en suisse enter site natural cialis side effects of cialis
سه شنبه 13 آذر 1397 03:00 ق.ظ
Hello there, I discovered your website by means of Google at the
same time as looking for a comparable topic,
your site came up, it looks great. I hzve bookmarked it inn my google bookmarks.

Hi there, justt changed into aware oof your weblog thru Google, and found that it is truly
informative. I'm going to wstch out for brussels. I will bbe grateful for those who
continue this in future. A lot of fooks wil likely be benefkted out of your writing.
Cheers!
سه شنبه 13 آذر 1397 02:22 ق.ظ
Hmm it appears like your site ate my first comment (it was super long)
so I guess I'll just sum it up what I wrote and say,
I'm thoroughly enjoying your blog. I too am an aspiring blog writer but I'm still new to everything.
Do you have any tips and hints for rookie blog writers? I'd really appreciate it.
سه شنبه 13 آذر 1397 12:49 ق.ظ

Nicely put. Many thanks!
cilas cialis daily new zealand pastillas cialis y alcoho cialis para que sirve try it no rx cialis cialis generico lilly the best choice cialis woman usa cialis online when will generic cialis be available cilas
دوشنبه 12 آذر 1397 11:49 ق.ظ

Many thanks, Wonderful stuff!
cialis canadian drugs cialis daily new zealand cialis 5 mg scheda tecnica cialis dosage recommendations buy original cialis cialis kaufen buy online cialis 5mg cialis pills price each cialis et insomni i recommend cialis generico
دوشنبه 12 آذر 1397 12:27 ق.ظ

Whoa all kinds of good material!
cialis authentique suisse prices on cialis 10 mg generic cialis at the pharmacy compare prices cialis uk acheter cialis kamagra cialis great britain achat cialis en europe cialis prezzo di mercato acheter du cialis a geneve cialis taglich
یکشنبه 11 آذر 1397 11:17 ق.ظ

Amazing plenty of amazing knowledge!
acheter du cialis a geneve low dose cialis blood pressure cialis professional from usa click here cialis daily uk india cialis 100mg cost we use it 50 mg cialis dose cialis kamagra levitra prices for cialis 50mg weblink price cialis 40 mg cialis what if i take
یکشنبه 11 آذر 1397 02:00 ق.ظ
I've read some just right stuff here. Certainly value bookmarking for
revisiting. I surprise how much effort you put to make this type
of magnificent informative site.
یکشنبه 11 آذر 1397 12:25 ق.ظ

Really many of very good info!
only best offers cialis use cialis 30 day trial coupon buying cialis on internet cialis daily cialis 5 mg schweiz cialis online napol enter site natural cialis cialis taglich acheter du cialis a geneve cialis et insomni
شنبه 10 آذر 1397 10:43 ب.ظ
There is definately a lot to learn about this subject.
I really like all tthe points you made.
شنبه 10 آذر 1397 11:10 ق.ظ

You definitely made your point!
cialis e hiv cialis online deutschland cialis pills in singapore cialis generico en mexico cialis great britain generic cialis 20mg uk cialis italia gratis acheter du cialis a geneve cialis generico postepay sialis
جمعه 9 آذر 1397 11:54 ب.ظ

Thank you, Numerous posts!

cialis daily price cialis per pill cialis efficacit enter site 20 mg cialis cost order generic cialis online cialis pills price each cialis generico online cialis dose 30mg cost of cialis cvs cialis tadalafil online
جمعه 9 آذر 1397 03:17 ب.ظ
Excellent post. I used to be checking constantly this blog and I'm inspired!
Extremely useful info specifically the final section :
) I handle such information much. I used to be seeking this certain information for a very lengthy time.
Thanks and good luck.
جمعه 9 آذر 1397 02:57 ب.ظ
Excellent blog! Do youu have aany tips for aspiring writers?
I'm hoping to start my own site soon but I'm a little lost on everything.
Would you recommnend starting with a freee platform like Wordpress
or go for a paid option? There are so many choices out there that I'm totally confused ..
Any suggestions? Thanks a lot!
 
لبخندناراحتچشمک
نیشخندبغلسوال
قلبخجالتزبان
ماچتعجبعصبانی
عینکشیطانگریه
خندهقهقههخداحافظ
سبزقهرهورا
دستگلتفکر


نمایش نظرات 1 تا 30