473,406 Members | 2,894 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

multi-statement table valued UDF

Three types of Functions are there-
1)Simple Scalar function-It returns a scalar value.

2)Inline-Table Valued UDF-
It allows us to return the table. Am I right or wrong??

3) Multi-statement table valued UDF-
Can somebody tell me the definition of it.

create table studentp(roll int,name varchar,marks int,address varchar(10))
insert into studentp values(1,'A',10,'FBD')
insert into studentp values(2,'B',20,'Delhi')
insert into studentp values(3,'C',30,'Gurgaon')
select * from studentp

create function info2(@roll int)Returns @myTable TABLE
(
roll int,
name varchar,
address varchar(10)
)
AS
BEGIN
INSERT @myTable
Select roll,name,address
FROM studentp
RETURN
END

SELECT * FROM dbo.info2(1)

When I m calling the function it shows all the rows of the table,but i m passing roll as parameter to the function & i m passing roll Number 1,function has to showed the result of only Roll Number 1 ,then why all the rows are returned.
Apr 16 '08 #1
1 1811
siva538
44
Three types of Functions are there-
1)Simple Scalar function-It returns a scalar value.

2)Inline-Table Valued UDF-
It allows us to return the table. Am I right or wrong??

3) Multi-statement table valued UDF-
Can somebody tell me the definition of it.

create table studentp(roll int,name varchar,marks int,address varchar(10))
insert into studentp values(1,'A',10,'FBD')
insert into studentp values(2,'B',20,'Delhi')
insert into studentp values(3,'C',30,'Gurgaon')
select * from studentp

create function info2(@roll int)Returns @myTable TABLE
(
roll int,
name varchar,
address varchar(10)
)
AS
BEGIN
INSERT @myTable
Select roll,name,address
FROM studentp
RETURN
END

SELECT * FROM dbo.info2(1)

When I m calling the function it shows all the rows of the table,but i m passing roll as parameter to the function & i m passing roll Number 1,function has to showed the result of only Roll Number 1 ,then why all the rows are returned.
You should use where condition for this :)

INSERT @myTable
Select roll,name,address
FROM studentp
WHERE roll = @roll

Better you verify yourself the questions you ask before posting !
Apr 16 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

37
by: ajikoe | last post by:
Hello, Is anyone has experiance in running python code to run multi thread parallel in multi processor. Is it possible ? Can python manage which cpu shoud do every thread? Sincerely Yours,...
4
by: Frank Jona | last post by:
Intellisense with C# and a multi-file assembly is not working. With VB.NET it is working. Is there a fix availible? We're using VisualStudio 2003 Regards Frank
12
by: * ProteanThread * | last post by:
but depends upon the clique: ...
0
by: frankenberry | last post by:
I have multi-page tiff files. I need to extract individual frames from the multi-page tiffs and save them as single-page tiffs. 95% of the time I receive multi-page tiffs containing 1 or more black...
6
by: cody | last post by:
What are multi file assemblies good for? What are the advantages of using multiple assemblies (A.DLL+B.DLL) vs. a single multi file assembly (A.DLL+A.NETMODULE)?
4
by: mimmo | last post by:
Hi! I should convert the accented letters of a string in the correspondent letters not accented. But when I compile with -Wall it give me: warning: multi-character character constant Do the...
5
by: Shane Story | last post by:
I can seem to get the dimensions of a frame in a multiframe tiff. After selecting activeframe, the Width/Height is still really much larger than the page's actual dimensions. When I split a...
5
by: bobwansink | last post by:
Hi, I'm relatively new to programming and I would like to create a C++ multi user program. It's for a project for school. This means I will have to write a paper about the theory too. Does anyone...
0
by: Sabri.Pllana | last post by:
We apologize if you receive multiple copies of this call for papers. *********************************************************************** 2008 International Workshop on Multi-Core Computing...
2
by: Aussie Rules | last post by:
Hi, I have a site that Iwant to either display my text in english or french, based on the users prefernces ? I am new to webforms, but I know in winforms, this is pretty easy with a resource...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.