Sunday, February 12, 2012

ALL Option

After consulting in MSFT textbooks, I tried adding a UNION to my SELECT
statement for parameters list
Select Distinct Homebase, HomebaseName From dbo.Portal_D_PrvList
UNION Select -1,'All Locations'
It gives me an error message "Error converting NVARCHAR value to datatype
integer" My values in dbo.Portal_D_PrvList tables are nvarchar as they are
text items. Any ideas?
ThanksTry this
Union ALL
Select -1 as Homebase,'All Locations' AS HomebaseName
"Asim" wrote:
> After consulting in MSFT textbooks, I tried adding a UNION to my SELECT
> statement for parameters list
> Select Distinct Homebase, HomebaseName From dbo.Portal_D_PrvList
> UNION Select -1,'All Locations'
> It gives me an error message "Error converting NVARCHAR value to datatype
> integer" My values in dbo.Portal_D_PrvList tables are nvarchar as they are
> text items. Any ideas?
> Thanks
>
>|||Not working!
"johnE" wrote:
> Try this
> Union ALL
> Select -1 as Homebase,'All Locations' AS HomebaseName
> "Asim" wrote:
> > After consulting in MSFT textbooks, I tried adding a UNION to my SELECT
> > statement for parameters list
> > Select Distinct Homebase, HomebaseName From dbo.Portal_D_PrvList
> > UNION Select -1,'All Locations'
> > It gives me an error message "Error converting NVARCHAR value to datatype
> > integer" My values in dbo.Portal_D_PrvList tables are nvarchar as they are
> > text items. Any ideas?
> > Thanks
> >
> >
> >|||You are trying to put an integer (-1) unioned with string. Try this:
Select Distinct Homebase, HomebaseName From dbo.Portal_D_PrvList UNION
Select '-1' as Homebase,'All Locations' as HomebaseName
"Asim" <Asim@.discussions.microsoft.com> wrote in message
news:1B362CCD-3A3A-4E70-A26F-EAC2E8076D1F@.microsoft.com...
> After consulting in MSFT textbooks, I tried adding a UNION to my SELECT
> statement for parameters list
> Select Distinct Homebase, HomebaseName From dbo.Portal_D_PrvList
> UNION Select -1,'All Locations'
> It gives me an error message "Error converting NVARCHAR value to datatype
> integer" My values in dbo.Portal_D_PrvList tables are nvarchar as they are
> text items. Any ideas?
> Thanks
>
>|||Try
union
select convert(varchar, -1) as Homebase
"Asim" <Asim@.discussions.microsoft.com> wrote in message
news:2D8D2E8A-47F8-4866-9547-8B8A0EBA3A09@.microsoft.com...
> Not working!
>
> "johnE" wrote:
>> Try this
>> Union ALL
>> Select -1 as Homebase,'All Locations' AS HomebaseName
>> "Asim" wrote:
>> > After consulting in MSFT textbooks, I tried adding a UNION to my SELECT
>> > statement for parameters list
>> > Select Distinct Homebase, HomebaseName From dbo.Portal_D_PrvList
>> > UNION Select -1,'All Locations'
>> > It gives me an error message "Error converting NVARCHAR value to
>> > datatype
>> > integer" My values in dbo.Portal_D_PrvList tables are nvarchar as they
>> > are
>> > text items. Any ideas?
>> > Thanks
>> >
>> >
>> >

No comments:

Post a Comment