Is there a way to display top 10 rows that have null value in one row? I have a table which has three columns(Table Name, Count, TopRecords) and I have a script which is used to fill the table. In the Table_Name it will have the name of the table, Count has the number of records that have a null fname in that table and I want to output top 10 record id in the TopRecords field. Is it possible to store 10 records in one row? Thanks.
If you can get the record ids then you can construct a string made up of those values, for example: select top 10 object_id from sys.objects declare @TopTen varchar(max) set @TopTen = STUFF(( SELECT top 10 ', ' + cast([object_id] as varchar) FROM sys.objects FOR XML PATH('') ), 1, 2, '') select @TopTen