I am Using an SQL Server 2008 R2 database with Visual Basic 2010. I use the following stored procedure; SELECT DISTINCT Category FROM tblBooks ORDER BY Category;This works fine except if its a new User with an empty or near empty table there will be nothing or very little for the User to select.
The following was recommended: SELECT DISTINCT Category FROM tblBooks UNION SELECT 'Add In 1' AS Category, 'Add In 2' As Category ORDER BY Category ORDER BY Category; There will be about 5 or 6 items to be added this way.
When testing in SSMS the code throws an error as shown below:
All queries combined using a UNION, INTERSECT or EXCEPT operator must have an equal number of expressions in their target lists.
I'm relly not sure what they are telling me or if the sql I am trying to use is the right method in doing it.