Hello all, I am new here. I am a SQL newbie, but I have a huge task assigned to me. I basically have to count rows in a bunch of tables where certain 'marked' columns don't have any NULLs. Consider the following example:
Please note that Table A contains many more columns, but only the 4 shown are to be considered. For the assignment, the total table count is 40, total column count is around 1400 and the average rows count across the 40 tables is ~5000.
To flesh out my dynamic SQL for the commented cell in the above example, I wrote the following code using a couple of cursors: http://db.tt/EJAPKLWW CONFIGURATIONITEMATTRIBUTES = top portion of the above example.
My output contains an additional 'OR' as shown here; I can't seem to get rid of it: http://db.tt/v4h3i5DL I understand why it is there, but as I am new to writing SPs (this is my first attempt), I don't know how to get rid of it.
Once the SQL statements are properly formed, I will also need to replace all the 'print' commands with a proper INSERT statement to get the 'Statistics' table shown in the bottom portion of the example.
I apologize for the dropbox links; I am just trying to be careful with company information. Finally, I have crossposted this on another site; if this is against the rule, please let me know.
Thanks much in advance! Please do ask if anything is unclear.