Please start any new threads on our new site at http://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2012 Forums
 Analysis Server and Reporting Services (2012)
 Highlighting a row once a parameter has been selec
 Reply to Topic
 Printer Friendly
Previous Page
Author Previous Topic Topic Next Topic
Page: of 2

wafw1971
Yak Posting Veteran

75 Posts

Posted - 04/30/2013 :  07:30:13  Show Profile  Reply with Quote
Hi Visakh

I have tried this and it doesn't work

Dataset

SELECT
Silks.SilksName
,SilksImages.Silks_Skey
FROM
Silks
INNER JOIN SilksImages
ON Silks.Silks_Skey = SilksImages.Silks_Skey
UNION ALL
SELECT NULL,
-1,
'',
NULL

Error Message

TITLE: Microsoft SQL Server Report Builder
------------------------------

An error occurred while executing the query.
All queries combined using a UNION, INTERSECT or EXCEPT operator must have an equal number of expressions in their target lists.

------------------------------
ADDITIONAL INFORMATION:

All queries combined using a UNION, INTERSECT or EXCEPT operator must have an equal number of expressions in their target lists. (Microsoft SQL Server, Error: 205)

For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft%20SQL%20Server&ProdVer=11.00.2218&EvtSrc=MSSQLServer&EvtID=205&LinkId=20476

------------------------------
BUTTONS:

OK
------------------------------
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

India
52326 Posts

Posted - 04/30/2013 :  08:01:05  Show Profile  Reply with Quote
you've different number of columns in both statements. they have to be same

SELECT
Silks.SilksName
,SilksImages.Silks_Skey
FROM
Silks
INNER JOIN SilksImages
ON Silks.Silks_Skey = SilksImages.Silks_Skey

UNION ALL

SELECT '',
-1



------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs

Edited by - visakh16 on 04/30/2013 08:01:32
Go to Top of Page
Page: of 2 Previous Topic Topic Next Topic  
Previous Page
 Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.15 seconds. Powered By: Snitz Forums 2000