Hi All,
Need your help in User-defined table type.
In oracle we have a user-defined table type
create or replace TYPE "names" as TABLE OF VARCHAR(50)
In the table we have a column ACTNAMES and when we execute that table result is like below
SELECT * FROM Organization
Output:
ACTNAMES
names('SSM - Respond to Surveys is Good','SSM - View All Response is Good') -- This is properly fit with the user-defined table type in oracle
How can we do the same thing in sql server with user-defined table type?
I have created a sample table
CREATE TABLE Test(ACTIVITY_NAMES VARCHAR(50))
I have created user-defined table type
CREATE TYPE ACTIVITY_NAMES_NT AS TABLE ( ACTIVITY_NAMES VARCHAR(50) )
I want data should be saved in the column ACTIVITY_NAMES like this 'SSM - Respond to Surveys is Good' ,'SSM - View All Response is Good'
Note: This complete ['SSM - Respond to Surveys is Good' ,'SSM - View All Response is Good'] value must be in single column and it must be fit with VARCHAR(50)
Please assist us with an example
Nitin SontakkePosted Oct 5, 2022, 2:43 AM
To the best of my knowledge, the User Defined Table Type (UDTTs) in SQL Server are read-only structures and data cannot be persisted on disk.
These are typically used to pass (read serialize) the data from applications (such as C#, etc) to database in a structured manner and in the form of several rows and columns just in one go.
On receiving end, the UDTT stored procedure parameter gets the data and is readonly in stored procedures body.
Hope that clarifies, but I could be wrong.