hi,
how to create nested table in sql server for example
employee table contains 3 column
id
name
address

where name should contain 3 sub columns like
firstname
middlename
lastname

how can i get this one help me plz

The short answer is you can't. Oracle has nested tables, but MS SQL server doesn't.
If you describe why you want this / what are you trying to achieve perhaps we can find you with an alternative (like 6 columns in your employee table that you concatenate in a view or a second table that will hold your name data).

That's only in Analysis Services. If you want a general relational table structure (as in you can use it for OLTP), SQL Server doesn't support nested tables.

Create a table with "id", "firstname", "middlename", "lastname", "address"

And select them into 1 field... closest I think you are going to get to what you seek...

Alternatively you can try different select statements or tricks to display in different ways... but I dont believe the nested tables are gonne fly

Depending on the need/application you could use a varchar field that would separate "fields" with a specific char and then either use charindex or split into an array from the front end or store XML into the field or ... , but not of these are a nested table.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.