I have a table Books
with two columns Id
, BookCategory
in a SQL Server database, where Id
is the primary key and BookCategory
contains JSON object.
This my table Books
I'm trying to get table BookCategory
column value as Category
only. For that, I wrote the following SQL query but I didn't get. any have an idea about to get JSON object value as the normal column value as a query result.
SELECT
Id, BookCategory.Name AS Name,
BookCategory.Category AS Category
FROM
Books
So the result will look like :
Id=1
Name=CA
Category=cs
And I'm getting an error in SQL Server Management Studio:
The multi-part identifier "BookCategory.Name" could not be bound.
Any help to get result same of the above table Books.
Thanks in advance.