Which of the following statements regarding SQL Server 2012 objects is TRUE?
A.
A user-defined data type can accept an input variable and return a table of results but cannot
be used within a view.
B.
A scalar function can accept an input variable and return a table of results but cannot be used
within a view.
C.
A table-valued function can accept an input variable and return a table of results but cannot be
used within a view.
D.
A table-valued type can accept an input variable and return a table of results but cannot be
used within a view.
Explanation:
It´s not A ? õ_Ô
YES ITS A
C is incorrect. See the link below
http://stackoverflow.com/questions/2877247/using-a-table-value-function-inside-a-view-in-sql-server
Here is the code to try from above link:
CREATE FUNCTION dbo.GetScheduleForEmployee()
RETURNS TABLE
AS
RETURN
(
SELECT 1 AS id
UNION ALL
SELECT 2
)
GO
CREATE VIEW myview
AS
SELECT *
FROM GetScheduleForEmployee() AS schedule
GO
SELECT *
FROM myview
C. A table-valued function can accept an input variable and return a table of results but cannot be used within a view.
Something wrong with the answers as it says the result cannot be used within a view.
You code demonstrate it can be used within a view.
It’s A
C
It is option A only
because you cant able to create user defined datatype inside views
you will get following error message
Msg 156, Level 15, State 1, Procedure ViewwithVariables, Line 4
Incorrect syntax near the keyword ‘declare’.
CREATE view ViewwithVariables
as
Declare @Cid int
set @Cid=154
SELECT * from
dbo.Partners P
join dbo.Events E on P.CompanyID=E.CompanyID
WHERE E.CompanyID=@cid
We came across a cool site which you could possibly delight in. Take a appear when you want.
we came across a cool internet site that you may well get pleasure from. Take a look should you want
that will be the end of this article. Here you will discover some web pages that we think you will value, just click the hyperlinks over
here are some hyperlinks to sites that we link to due to the fact we think they’re really worth visiting
just beneath, are several completely not related websites to ours, however, they may be certainly worth going over
very few sites that transpire to become detailed below, from our point of view are undoubtedly properly worth checking out
usually posts some quite intriguing stuff like this. If youre new to this site