im getting this error : Invalid attempt to read when there no data is present.
getting error from reading data from column which is although not present in table when view is created that column in generated and add spcific data in that column . It means that column is available when i open view data in sql server management studio.
but im getting error in getting values from that column
Thanks
Mark My Post As An Answer If It Worked !
Please Visit : www.classifiedspak.com
When you query the view in SSMS, can you see the data?
Hi ,
following is the query which displays data , i saved it as a view in sql server but unable to get column value
SELECT R2.category, R2.subcategory, R2.keywords, tblCategories.formtype, tblCategories.metadescription
FROM tblCategories INNER JOIN
(SELECT [category], [subcategory], STUFF
((SELECT ',' + [subcategory] AS 'text()'
FROM tblCategories t2
WHERE t2.[category] = t1.[category] FOR XML PATH('')), 1, 1, '') AS [keywords]
FROM tblCategories t1
GROUP BY category, subcategory) R2 ON tblCategories.subcategory = R2.subcategory
following is the query which displays data , i saved it as a view in sql server but unable to get column value
Hi,
Do you means you couldn't get the values in your view? Have you tested it in the SSMS? If not, please test it.
CREATE VIEW [VIEW_TEST] AS
SELECT R2.category, R2.subcategory, R2.keywords, tblCategories.formtype, tblCategories.metadescription
FROM tblCategories INNER JOIN
(SELECT [category], [subcategory], STUFF
((SELECT ',' + [subcategory] AS 'text()'
FROM tblCategories t2
WHERE t2.[category] = t1.[category] FOR XML PATH('')), 1, 1, '') AS [keywords]
FROM tblCategories t1
GROUP BY category, subcategory) R2 ON tblCategories.subcategory = R2.subcategory
SELECT * FROM [VIEW_TEST]
If the view show its values in SSMS, please tell us more information about using it in your project. It will provide us more information about your problem. With your error message you post, below link may help you.
shan000
Member
491 Points
446 Posts
unable to get data from sql server view
May 08, 2012 02:54 PM|LINK
Hi ,
im unable to read data from sql server view
im getting this error : Invalid attempt to read when there no data is present.
getting error from reading data from column which is although not present in table when view is created that column in generated and add spcific data in that column . It means that column is available when i open view data in sql server management studio.
but im getting error in getting values from that column
Thanks
Please Visit : www.classifiedspak.com
christiandev
Star
8597 Points
1841 Posts
Re: unable to get data from sql server view
May 08, 2012 05:04 PM|LINK
can you post some code?
When you query the view in SSMS, can you see the data?
Regards, Christiandev (@chrisdev80), MCPD Web (2 & 4) & MCTS Windows (www.ScoreDonkey.com)
shan000
Member
491 Points
446 Posts
Re: unable to get data from sql server view
May 08, 2012 07:07 PM|LINK
Hi ,
following is the query which displays data , i saved it as a view in sql server but unable to get column value
SELECT R2.category, R2.subcategory, R2.keywords, tblCategories.formtype, tblCategories.metadescription
FROM tblCategories INNER JOIN
(SELECT [category], [subcategory], STUFF
((SELECT ',' + [subcategory] AS 'text()'
FROM tblCategories t2
WHERE t2.[category] = t1.[category] FOR XML PATH('')), 1, 1, '') AS [keywords]
FROM tblCategories t1
GROUP BY category, subcategory) R2 ON tblCategories.subcategory = R2.subcategory
while
Please Visit : www.classifiedspak.com
Chen Yu - MS...
All-Star
21569 Points
2493 Posts
Microsoft
Re: unable to get data from sql server view
May 14, 2012 09:03 AM|LINK
Hi,
Do you means you couldn't get the values in your view? Have you tested it in the SSMS? If not, please test it.
CREATE VIEW [VIEW_TEST] AS SELECT R2.category, R2.subcategory, R2.keywords, tblCategories.formtype, tblCategories.metadescription FROM tblCategories INNER JOIN (SELECT [category], [subcategory], STUFF ((SELECT ',' + [subcategory] AS 'text()' FROM tblCategories t2 WHERE t2.[category] = t1.[category] FOR XML PATH('')), 1, 1, '') AS [keywords] FROM tblCategories t1 GROUP BY category, subcategory) R2 ON tblCategories.subcategory = R2.subcategory SELECT * FROM [VIEW_TEST]If the view show its values in SSMS, please tell us more information about using it in your project. It will provide us more information about your problem. With your error message you post, below link may help you.
Please see: http://stackoverflow.com/questions/6323241/invalidoperationexception-invalid-attempt-to-read-when-no-data-is-present-sql
Thanks.
Feedback to us
Develop and promote your apps in Windows Store