I have created some user-defined types to be used as table-valued parameters. Is there any way I could select their columns, just like I can select columns for a table:
SELECT * FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_NAME LIKE 'MyTable'
Edit: yes, I tried to read MSDN, but I don't see the information there. My current workaround is to create a permanent table as follows:
CREATE TABLE Placeholder(copy-and-paste all the columns from my type here)
Then I can select from INFORMATION_SCHEMA.COLUMNS and drop Placeholder when I am done.
You can get the MySQL table columns data type with the help of “information_schema. columns”. SELECT DATA_TYPE from INFORMATION_SCHEMA. COLUMNS where table_schema = 'yourDatabaseName' and table_name = 'yourTableName'.
To select multiple columns from a table, simply separate the column names with commas! For example, this query selects two columns, name and birthdate , from the people table: SELECT name, birthdate FROM people; Sometimes, you may want to select all columns from a table.
This will give you a list of columns for the table type TVPTest
select c.*
from sys.table_types as tt
inner join sys.columns as c
on tt.type_table_object_id = c.object_id
where tt.name = 'TVPTest'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With