alignment issue on column level

  • i am using below code and i am facing some alignment issue on column level as last column is not match with header and data value .

    Any sugessions pls.Please find attachment for reference.

    ========================================================

    SET @tableHTML =

    N'<H1>details</H1>' +

    N'<table border="1">' +

    N'<tr><th>createdate</th>' +

    N'<th>dbname</th>' +

    N'<th>username</th>' +

    N'<th>db_owner</th>' +

    N'<th>db_accessadmin</th>' +

    N'<th>DB_securityadmin</th>' +

    N'<th>db_ddladmin</th>' +

    N'<th>DB_datareader</th>' +

    N'<th>Db_datawriter</th>' +

    N'<th>Db_denydatareader</th></tr>' +

    N'<th>Db_denydatawriter</th></tr>' +

    CAST ( ( SELECT "td/@align" = 'right', td = createdate, '',

    "td/@align" = 'right', td = dbname, '',

    "td/@align" = 'right', td = username, '',

    "td/@align" = 'right', td = DB_owner, '',

    "td/@align" = 'right', td = DB_accessadmin, '',

    "td/@align" = 'right', td = DB_securityadmin, '',

    "td/@align" = 'right', td = DB_ddladmin, '',

    "td/@align" = 'right', td = DB_datareader, '',

    "td/@align" = 'right', td = DB_datawriter, '',

    "td/@align" = 'right', td = DB_denydatareader, '',

    "td/@align" = 'right', td = DB_denydatawriter, ''

    FROM #Tablename

    FOR XML PATH('tr'), TYPE

    ) AS NVARCHAR(MAX) ) +

    N'</table>' ;

    ====================================================================

  • Change

    N'<th>Db_denydatareader</th></tr>' +

    to

    N'<th>Db_denydatareader</th>' +

    ____________________________________________________

    Deja View - The strange feeling that somewhere, sometime you've optimised this query before

    How to get the best help on a forum

    http://www.sqlservercentral.com/articles/Best+Practices/61537
  • You've got two table row end tags in your header row, remove the </tr> from <th>Db_denydatareader</th></tr>

  • Thank you!!!

    Its working now.

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply