Trying to build a report that will return information on many
contacts.
SELECT ContactExtensionBase.ContactId, ContactBase.LastName,
FROM ContactExtensionBase INNER JOIN
ContactBase ON ContactExtensionBase.ContactId = ContactBase.ContactId
WHERE (ContactBase.ContactId = @.cid)
where @.cid is the guid's
But with it like this i can't pass more than one guid into the
statement.Try using the "IN" clause so your WHERE statement looks like:
WHERE ContactBase.ContactId IN(@.cid)
If your parameter is set to accept multiple values then this will retrun ALL
values you select.
Michael
"flowk1337@.gmail.com" wrote:
> Trying to build a report that will return information on many
> contacts.
> SELECT ContactExtensionBase.ContactId, ContactBase.LastName,
> FROM ContactExtensionBase INNER JOIN
> ContactBase ON ContactExtensionBase.ContactId => ContactBase.ContactId
> WHERE (ContactBase.ContactId = @.cid)
>
> where @.cid is the guid's
>
> But with it like this i can't pass more than one guid into the
> statement.
>|||On Apr 27, 4:02 pm, Michael C <Michael C...@.discussions.microsoft.com>
wrote:
> Try using the "IN" clause so your WHERE statement looks like:
> WHERE ContactBase.ContactId IN(@.cid)
> If your parameter is set to accept multiple values then this will retrun ALL
> values you select.
> Michael
>
> "flowk1...@.gmail.com" wrote:
> > Trying to build a report that will return information on many
> > contacts.
> > SELECT ContactExtensionBase.ContactId, ContactBase.LastName,
> > FROM ContactExtensionBase INNER JOIN
> > ContactBase ON ContactExtensionBase.ContactId => > ContactBase.ContactId
> > WHERE (ContactBase.ContactId = @.cid)
> > where @.cid is the guid's
> > But with it like this i can't pass more than one guid into the
> > statement.- Hide quoted text -
> - Show quoted text -
I've already tried that actually. It gives an error that a I can't
convert from a guid to a string.|||Is the convertion error a matter of Collation? If so you may want to try and
COLLATE your join statement. I just can't see why a guid couldn't convert to
a string.
INNER JOIN
ContactBase ON ContactExtensionBase.ContactId COLLATE
SQL_Latin1_General_CP1_CI_AS = ContactBase.ContactId
have you tried to CAST or CONVERT the guid?
"flowk1337@.gmail.com" wrote:
> On Apr 27, 4:02 pm, Michael C <Michael C...@.discussions.microsoft.com>
> wrote:
> > Try using the "IN" clause so your WHERE statement looks like:
> >
> > WHERE ContactBase.ContactId IN(@.cid)
> >
> > If your parameter is set to accept multiple values then this will retrun ALL
> > values you select.
> >
> > Michael
> >
> >
> >
> > "flowk1...@.gmail.com" wrote:
> > > Trying to build a report that will return information on many
> > > contacts.
> >
> > > SELECT ContactExtensionBase.ContactId, ContactBase.LastName,
> > > FROM ContactExtensionBase INNER JOIN
> > > ContactBase ON ContactExtensionBase.ContactId => > > ContactBase.ContactId
> > > WHERE (ContactBase.ContactId = @.cid)
> >
> > > where @.cid is the guid's
> >
> > > But with it like this i can't pass more than one guid into the
> > > statement.- Hide quoted text -
> >
> > - Show quoted text -
> I've already tried that actually. It gives an error that a I can't
> convert from a guid to a string.
>|||On Apr 27, 5:56 pm, Michael C <Micha...@.discussions.microsoft.com>
wrote:
> Is the convertion error a matter of Collation? If so you may want to try and
> COLLATE your join statement. I just can't see why a guid couldn't convert to
> a string.
> INNER JOIN
> ContactBase ON ContactExtensionBase.ContactId COLLATE
> SQL_Latin1_General_CP1_CI_AS => ContactBase.ContactId
> have you tried to CAST or CONVERT the guid?
>
> "flowk1...@.gmail.com" wrote:
> > On Apr 27, 4:02 pm, Michael C <Michael C...@.discussions.microsoft.com>
> > wrote:
> > > Try using the "IN" clause so your WHERE statement looks like:
> > > WHERE ContactBase.ContactId IN(@.cid)
> > > If your parameter is set to accept multiple values then this will retrun ALL
> > > values you select.
> > > Michael
> > > "flowk1...@.gmail.com" wrote:
> > > > Trying to build a report that will return information on many
> > > > contacts.
> > > > SELECT ContactExtensionBase.ContactId, ContactBase.LastName,
> > > > FROM ContactExtensionBase INNER JOIN
> > > > ContactBase ON ContactExtensionBase.ContactId => > > > ContactBase.ContactId
> > > > WHERE (ContactBase.ContactId = @.cid)
> > > > where @.cid is the guid's
> > > > But with it like this i can't pass more than one guid into the
> > > > statement.- Hide quoted text -
> > > - Show quoted text -
> > I've already tried that actually. It gives an error that a I can't
> > convert from a guid to a string.- Hide quoted text -
> - Show quoted text -
I found out how to fix my problem. Thanks for your help Michael.
I created a stored procedure with the following:
DECLARE @.GUIDV VARCHAR(7000)
SELECT @.GUIDV = '''' + REPLACE(@.GUIDS , ',', '''' + ',' + '''')
+ ''''
EXECUTE('SELECT ContactExtensionBase.ContactId,
ContactExtensionBase.New_DLNumber, ContactBase.LastName,
ContactBase.MiddleName, ContactBase.FirstName, ContactBase.BirthDate,
ContactBase.MobilePhone, ContactBase.Pager, ContactBase.Telephone1,
ContactBase.StateCode,ContactExtensionBase.New_ReferralName,
ContactBase.Telephone2, ContactBase.Telephone3 FROM
ContactExtensionBase INNER JOIN
ContactBase ON ContactExtensionBase.ContactId =ContactBase.ContactId WHERE ContactId IN (' + @.GUIDV + ')')
Showing posts with label return. Show all posts
Showing posts with label return. Show all posts
Wednesday, March 28, 2012
Monday, February 20, 2012
pasing a set of records to SP
hi
I need to send a set of records to a SP in order to make some comparisos and
calculations and return back from the SP the same records but modified
What is the best (faster,optimal) way to send the records from my client App
via internet to the SQLDB in order to the SP reading those records?
I just discover that a SP does not accept arrays as input parameters.
thks
kenhttp://www.sommarskog.se/arrays-in-sql.html
"Kenny M." <KennyM@.discussions.microsoft.com> wrote in message
news:F69119F4-7020-4B87-9BCA-414F3A446AFC@.microsoft.com...
> hi
> I need to send a set of records to a SP in order to make some comparisos
and
> calculations and return back from the SP the same records but modified
> What is the best (faster,optimal) way to send the records from my client
App
> via internet to the SQLDB in order to the SP reading those records?
>
> I just discover that a SP does not accept arrays as input parameters.
> thks
> ken
>
I need to send a set of records to a SP in order to make some comparisos and
calculations and return back from the SP the same records but modified
What is the best (faster,optimal) way to send the records from my client App
via internet to the SQLDB in order to the SP reading those records?
I just discover that a SP does not accept arrays as input parameters.
thks
kenhttp://www.sommarskog.se/arrays-in-sql.html
"Kenny M." <KennyM@.discussions.microsoft.com> wrote in message
news:F69119F4-7020-4B87-9BCA-414F3A446AFC@.microsoft.com...
> hi
> I need to send a set of records to a SP in order to make some comparisos
and
> calculations and return back from the SP the same records but modified
> What is the best (faster,optimal) way to send the records from my client
App
> via internet to the SQLDB in order to the SP reading those records?
>
> I just discover that a SP does not accept arrays as input parameters.
> thks
> ken
>
Subscribe to:
Posts (Atom)