Showing posts with label attempting. Show all posts
Showing posts with label attempting. Show all posts

Saturday, February 25, 2012

"Creating a Mobile Application with SQL Server" Tutorial Problem

I am attempting to go through the "Creating a Mobile Application with SQL Server" walkthrough found in the SQL Mobile Books Online help file. Towards the end of this document (under SQL Server Mobile Tasks), they show how to create a new subscription. Unfortunately, after step 10--when you are asked to click finish--I get the following error:

TITLE: Microsoft SQL Server Management Studio

Failure to connect to SQL Server with provided connection information. SQL Server does not exist, access is denied because the IIS user is not a valid user on the SQL Server, or the password is incorrect.
HRESULT 0x80004005 (29061)

One potential area of concern is in setting up the windows authentication login. Step two of "Secure the publication" states "type computername\iusr_computername, where computername is the name of your computer." I was not sure what iusr_computername stood for--should I just type in my windows account for this machine? Or am I to make an account called "isur_computername?"

I just restarted my system and now receive a different error (at the same place):

TITLE: Microsoft SQL Server Management Studio

Authentication failed on the computer running IIS.
HRESULT 0x80070057 (28011)

|||

Hi,

IUSR_<IISMachineName> is an account automatically built-in and would be created automatically when IIS is installed. This is the login account that would be used when you chose the authentication as anonymous. Simply to say, this is anonymous user account. Ofcourse, you can change IIS to use a different account as anonymous account. Now, please replace the 'IISMachineName' with IIS Machine name in your environment and assign permissions to this IUSR account on Virtual Directory (read & write, create and delete files).

Hope this helps!

Thanks,

Laxmi Narsimha Rao ORUGANTI, MSFT, SQL Everywhere, Microsoft Corporation

|||I'm having the same problem when I try to use a subscription for MS SQL 2005 I get the same error message. I have tried to use different account including the IUSR_<machinename> but have the same problem.|||

Hi keyboardape. Did you solve your problem?

I met the same issue like your and I solved it today.

Let me know

|||

I am getting this same message! I'm trying to get the AdventureWorks merge replication sample using a mobile device to work.

I have tried both anonymous and authenticated and used various users. Any help? Thanks!

|||

Hi Nick, what was the solution?

initially I had the exactly same error as jonfroehlich ...

the walkthrough goes fine until step 10 of 'create a new subscripition' then it just fails and gives the following error:

--

Failure to connect to SQL Server with provided connection information.
SQL Server does not exist, access is denied because the IIS user is not a valid user on the SQL Server, or the password is incorrect.
HRESULT 0x80004005 (29061)
The operation could not be completed.

--

but after running it again the error msg has changed to ...

--

Initializing SQL Server Reconciler has failed.
HRESULT 0x80045901 (29045)
The process could not connect to Distributor '<mycomputername>.
HRESULT 0x00004E74 (0)The operation could not be completed.
--

I created a new iusr_<computername> account as directed in the walkthrough and have assigned it accordingly...

can you help?

Thanks

|||Hi there
as Laxmi suggested, you do have to set up the IIS and the authentication correctly
try the following:
1. after creating your publication on the management studio, add the user IUSR_<IISMachineName> in the security->login folder
Important: you don't have to create that user, this user already exist, so look it up under advanced search!!
2. rightclick on that user and choose properties
3. under usermappings check the box of the database you would like to access, then click ok
4. rightclick on your publication and choose properties
5. select publication access list an add the IUSR_<IISMachineName> user and click ok
6. rightclick on your publication, select view snapshot status and generate the snapshot

7. execute the web synchronisation wizard (conwizz30.exe) before the subscription wizard!!
this wizard creates the virtual directory for the webaccess, choose annonymous access
8. execute the subscription wizard and use windowsauthentication

the following link helps a lot:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnppcgen/html/med302_msdn_sql_mobile.asp?frame=true

by the way, check the port (settigns-Controlpanel-administrativetool-iis) of your IIS (default is 80) but it might be possible that it's not (if you use skype or such appilations)
if it's not 80 you have to add the port to the url in the WebServer Authentication Step of the Subscription Wizard like 192.168.0.111:81/myVirtDir

Hop it helps
Greets Florian
|||

In my case, I got a very similar error message while trying to use SQL server authentication with the 'sa' account.

- Synchronizing Data (100%) (Error)

Messages

* Failure to connect to SQL Server with provided connection information. SQL Server does not exist, access is denied because the SQL user is not a valid user on the SQL Server, or the password is incorrect.

HRESULT 0x80004005 (29060)

It turned out sa account was disabled by default.

|||

I have the same problem. The fix of Florian did not help me.

Any suggestion?

Thanks

GIo

|||

It is Correct.

Thanks. I got the solution. I have created a Word Document to configure step by step.

But, I dont know how to upload it here to help others.

|||

Hi,

Previously I was using Sql mobile in device, that was worked fine with SQL Server 2005. Now as per client's requirement they want the Database in sql ce and sql server 2000.

First of all I would like to know that which are the required cab files for sql ce environment in the device and from where i can get those?

When i see the merge agent, it is connecting Sql server 2000 from sql mobile and it is able to connect the sql server 2000 publisher, but after connecting to publisher when it tries to connect the subscriber it stops with message "Connecting to subscriber WM_Dhaval1". after waiting for 10 minutes the message changes to "The agent is suspect, no response within last 10 minutes" with failed satus. I am sure the problem is with subscriber.

Is sql mobile compatible with sql server 2000? or i have to use sql ce for mobile device explicitely?

|||Was having the same issue. I believe it is caused because I have multiple network cards.

I got this tutorial working, when in the wizard to create a new subscription on the page "choose publication" I selected the aktual server name (my pc name) rather than (local). Then it worked for me.

good luck
|||I have the same problem, each time to subscribe the subscription said that the IIS user is not valid SQL Server user. When I create publication on Windows XP the problem is solved, but when I try on Vista the problem go back again. I have create SQL Server login for IUSR and put it into Publication Access List (PAL) of my publication. Is there any user that I must include for IIS 7 or only IUSR.

Sorry I'm really new on discovering IIS 7, for IIS 6 just fine for me.

Thanks,

"Creating a Mobile Application with SQL Server" Tutorial Problem

I am attempting to go through the "Creating a Mobile Application with SQL Server" walkthrough found in the SQL Mobile Books Online help file. Towards the end of this document (under SQL Server Mobile Tasks), they show how to create a new subscription. Unfortunately, after step 10--when you are asked to click finish--I get the following error:

TITLE: Microsoft SQL Server Management Studio

Failure to connect to SQL Server with provided connection information. SQL Server does not exist, access is denied because the IIS user is not a valid user on the SQL Server, or the password is incorrect.
HRESULT 0x80004005 (29061)

One potential area of concern is in setting up the windows authentication login. Step two of "Secure the publication" states "type computername\iusr_computername, where computername is the name of your computer." I was not sure what iusr_computername stood for--should I just type in my windows account for this machine? Or am I to make an account called "isur_computername?"

I just restarted my system and now receive a different error (at the same place):

TITLE: Microsoft SQL Server Management Studio

Authentication failed on the computer running IIS.
HRESULT 0x80070057 (28011)

|||

Hi,

IUSR_<IISMachineName> is an account automatically built-in and would be created automatically when IIS is installed. This is the login account that would be used when you chose the authentication as anonymous. Simply to say, this is anonymous user account. Ofcourse, you can change IIS to use a different account as anonymous account. Now, please replace the 'IISMachineName' with IIS Machine name in your environment and assign permissions to this IUSR account on Virtual Directory (read & write, create and delete files).

Hope this helps!

Thanks,

Laxmi Narsimha Rao ORUGANTI, MSFT, SQL Everywhere, Microsoft Corporation

|||I'm having the same problem when I try to use a subscription for MS SQL 2005 I get the same error message. I have tried to use different account including the IUSR_<machinename> but have the same problem.|||

Hi keyboardape. Did you solve your problem?

I met the same issue like your and I solved it today.

Let me know

|||

I am getting this same message! I'm trying to get the AdventureWorks merge replication sample using a mobile device to work.

I have tried both anonymous and authenticated and used various users. Any help? Thanks!

|||

Hi Nick, what was the solution?

initially I had the exactly same error as jonfroehlich ...

the walkthrough goes fine until step 10 of 'create a new subscripition' then it just fails and gives the following error:

--

Failure to connect to SQL Server with provided connection information.
SQL Server does not exist, access is denied because the IIS user is not a valid user on the SQL Server, or the password is incorrect.
HRESULT 0x80004005 (29061)
The operation could not be completed.

--

but after running it again the error msg has changed to ...

--

Initializing SQL Server Reconciler has failed.
HRESULT 0x80045901 (29045)
The process could not connect to Distributor '<mycomputername>.
HRESULT 0x00004E74 (0)The operation could not be completed.
--

I created a new iusr_<computername> account as directed in the walkthrough and have assigned it accordingly...

can you help?

Thanks

|||Hi there
as Laxmi suggested, you do have to set up the IIS and the authentication correctly
try the following:
1. after creating your publication on the management studio, add the user IUSR_<IISMachineName> in the security->login folder
Important: you don't have to create that user, this user already exist, so look it up under advanced search!!
2. rightclick on that user and choose properties
3. under usermappings check the box of the database you would like to access, then click ok
4. rightclick on your publication and choose properties
5. select publication access list an add the IUSR_<IISMachineName> user and click ok
6. rightclick on your publication, select view snapshot status and generate the snapshot

7. execute the web synchronisation wizard (conwizz30.exe) before the subscription wizard!!
this wizard creates the virtual directory for the webaccess, choose annonymous access
8. execute the subscription wizard and use windowsauthentication

the following link helps a lot:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnppcgen/html/med302_msdn_sql_mobile.asp?frame=true

by the way, check the port (settigns-Controlpanel-administrativetool-iis) of your IIS (default is 80) but it might be possible that it's not (if you use skype or such appilations)
if it's not 80 you have to add the port to the url in the WebServer Authentication Step of the Subscription Wizard like 192.168.0.111:81/myVirtDir

Hop it helps
Greets Florian
|||

In my case, I got a very similar error message while trying to use SQL server authentication with the 'sa' account.

- Synchronizing Data (100%) (Error)

Messages

* Failure to connect to SQL Server with provided connection information. SQL Server does not exist, access is denied because the SQL user is not a valid user on the SQL Server, or the password is incorrect.

HRESULT 0x80004005 (29060)

It turned out sa account was disabled by default.

|||

I have the same problem. The fix of Florian did not help me.

Any suggestion?

Thanks

GIo

|||

It is Correct.

Thanks. I got the solution. I have created a Word Document to configure step by step.

But, I dont know how to upload it here to help others.

|||

Hi,

Previously I was using Sql mobile in device, that was worked fine with SQL Server 2005. Now as per client's requirement they want the Database in sql ce and sql server 2000.

First of all I would like to know that which are the required cab files for sql ce environment in the device and from where i can get those?

When i see the merge agent, it is connecting Sql server 2000 from sql mobile and it is able to connect the sql server 2000 publisher, but after connecting to publisher when it tries to connect the subscriber it stops with message "Connecting to subscriber WM_Dhaval1". after waiting for 10 minutes the message changes to "The agent is suspect, no response within last 10 minutes" with failed satus. I am sure the problem is with subscriber.

Is sql mobile compatible with sql server 2000? or i have to use sql ce for mobile device explicitely?

|||Was having the same issue. I believe it is caused because I have multiple network cards.

I got this tutorial working, when in the wizard to create a new subscription on the page "choose publication" I selected the aktual server name (my pc name) rather than (local). Then it worked for me.

good luck
|||I have the same problem, each time to subscribe the subscription said that the IIS user is not valid SQL Server user. When I create publication on Windows XP the problem is solved, but when I try on Vista the problem go back again. I have create SQL Server login for IUSR and put it into Publication Access List (PAL) of my publication. Is there any user that I must include for IIS 7 or only IUSR.

Sorry I'm really new on discovering IIS 7, for IIS 6 just fine for me.

Thanks,

"Creating a Mobile Application with SQL Server" Tutorial Problem

I am attempting to go through the "Creating a Mobile Application with SQL Server" walkthrough found in the SQL Mobile Books Online help file. Towards the end of this document (under SQL Server Mobile Tasks), they show how to create a new subscription. Unfortunately, after step 10--when you are asked to click finish--I get the following error:

TITLE: Microsoft SQL Server Management Studio

Failure to connect to SQL Server with provided connection information. SQL Server does not exist, access is denied because the IIS user is not a valid user on the SQL Server, or the password is incorrect.
HRESULT 0x80004005 (29061)

One potential area of concern is in setting up the windows authentication login. Step two of "Secure the publication" states "type computername\iusr_computername, where computername is the name of your computer." I was not sure what iusr_computername stood for--should I just type in my windows account for this machine? Or am I to make an account called "isur_computername?"

I just restarted my system and now receive a different error (at the same place):

TITLE: Microsoft SQL Server Management Studio

Authentication failed on the computer running IIS.
HRESULT 0x80070057 (28011)

|||

Hi,

IUSR_<IISMachineName> is an account automatically built-in and would be created automatically when IIS is installed. This is the login account that would be used when you chose the authentication as anonymous. Simply to say, this is anonymous user account. Ofcourse, you can change IIS to use a different account as anonymous account. Now, please replace the 'IISMachineName' with IIS Machine name in your environment and assign permissions to this IUSR account on Virtual Directory (read & write, create and delete files).

Hope this helps!

Thanks,

Laxmi Narsimha Rao ORUGANTI, MSFT, SQL Everywhere, Microsoft Corporation

|||I'm having the same problem when I try to use a subscription for MS SQL 2005 I get the same error message. I have tried to use different account including the IUSR_<machinename> but have the same problem.|||

Hi keyboardape. Did you solve your problem?

I met the same issue like your and I solved it today.

Let me know

|||

I am getting this same message! I'm trying to get the AdventureWorks merge replication sample using a mobile device to work.

I have tried both anonymous and authenticated and used various users. Any help? Thanks!

|||

Hi Nick, what was the solution?

initially I had the exactly same error as jonfroehlich ...

the walkthrough goes fine until step 10 of 'create a new subscripition' then it just fails and gives the following error:

--

Failure to connect to SQL Server with provided connection information.
SQL Server does not exist, access is denied because the IIS user is not a valid user on the SQL Server, or the password is incorrect.
HRESULT 0x80004005 (29061)
The operation could not be completed.

--

but after running it again the error msg has changed to ...

--

Initializing SQL Server Reconciler has failed.
HRESULT 0x80045901 (29045)
The process could not connect to Distributor '<mycomputername>.
HRESULT 0x00004E74 (0)The operation could not be completed.
--

I created a new iusr_<computername> account as directed in the walkthrough and have assigned it accordingly...

can you help?

Thanks

|||Hi there
as Laxmi suggested, you do have to set up the IIS and the authentication correctly
try the following:
1. after creating your publication on the management studio, add the user IUSR_<IISMachineName> in the security->login folder
Important: you don't have to create that user, this user already exist, so look it up under advanced search!!
2. rightclick on that user and choose properties
3. under usermappings check the box of the database you would like to access, then click ok
4. rightclick on your publication and choose properties
5. select publication access list an add the IUSR_<IISMachineName> user and click ok
6. rightclick on your publication, select view snapshot status and generate the snapshot

7. execute the web synchronisation wizard (conwizz30.exe) before the subscription wizard!!
this wizard creates the virtual directory for the webaccess, choose annonymous access
8. execute the subscription wizard and use windowsauthentication

the following link helps a lot:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnppcgen/html/med302_msdn_sql_mobile.asp?frame=true

by the way, check the port (settigns-Controlpanel-administrativetool-iis) of your IIS (default is 80) but it might be possible that it's not (if you use skype or such appilations)
if it's not 80 you have to add the port to the url in the WebServer Authentication Step of the Subscription Wizard like 192.168.0.111:81/myVirtDir

Hop it helps
Greets Florian|||

In my case, I got a very similar error message while trying to use SQL server authentication with the 'sa' account.

- Synchronizing Data (100%) (Error)

Messages

* Failure to connect to SQL Server with provided connection information. SQL Server does not exist, access is denied because the SQL user is not a valid user on the SQL Server, or the password is incorrect.

HRESULT 0x80004005 (29060)

It turned out sa account was disabled by default.

|||

I have the same problem. The fix of Florian did not help me.

Any suggestion?

Thanks

GIo

|||

It is Correct.

Thanks. I got the solution. I have created a Word Document to configure step by step.

But, I dont know how to upload it here to help others.

|||

Hi,

Previously I was using Sql mobile in device, that was worked fine with SQL Server 2005. Now as per client's requirement they want the Database in sql ce and sql server 2000.

First of all I would like to know that which are the required cab files for sql ce environment in the device and from where i can get those?

When i see the merge agent, it is connecting Sql server 2000 from sql mobile and it is able to connect the sql server 2000 publisher, but after connecting to publisher when it tries to connect the subscriber it stops with message "Connecting to subscriber WM_Dhaval1". after waiting for 10 minutes the message changes to "The agent is suspect, no response within last 10 minutes" with failed satus. I am sure the problem is with subscriber.

Is sql mobile compatible with sql server 2000? or i have to use sql ce for mobile device explicitely?

|||Was having the same issue. I believe it is caused because I have multiple network cards.

I got this tutorial working, when in the wizard to create a new subscription on the page "choose publication" I selected the aktual server name (my pc name) rather than (local). Then it worked for me.

good luck|||I have the same problem, each time to subscribe the subscription said that the IIS user is not valid SQL Server user. When I create publication on Windows XP the problem is solved, but when I try on Vista the problem go back again. I have create SQL Server login for IUSR and put it into Publication Access List (PAL) of my publication. Is there any user that I must include for IIS 7 or only IUSR.

Sorry I'm really new on discovering IIS 7, for IIS 6 just fine for me.

Thanks,

"Creating a Mobile Application with SQL Server" Tutorial Problem

I am attempting to go through the "Creating a Mobile Application with SQL Server" walkthrough found in the SQL Mobile Books Online help file. Towards the end of this document (under SQL Server Mobile Tasks), they show how to create a new subscription. Unfortunately, after step 10--when you are asked to click finish--I get the following error:

TITLE: Microsoft SQL Server Management Studio

Failure to connect to SQL Server with provided connection information. SQL Server does not exist, access is denied because the IIS user is not a valid user on the SQL Server, or the password is incorrect.
HRESULT 0x80004005 (29061)

One potential area of concern is in setting up the windows authentication login. Step two of "Secure the publication" states "type computername\iusr_computername, where computername is the name of your computer." I was not sure what iusr_computername stood for--should I just type in my windows account for this machine? Or am I to make an account called "isur_computername?"

I just restarted my system and now receive a different error (at the same place):

TITLE: Microsoft SQL Server Management Studio

Authentication failed on the computer running IIS.
HRESULT 0x80070057 (28011)

|||

Hi,

IUSR_<IISMachineName> is an account automatically built-in and would be created automatically when IIS is installed. This is the login account that would be used when you chose the authentication as anonymous. Simply to say, this is anonymous user account. Ofcourse, you can change IIS to use a different account as anonymous account. Now, please replace the 'IISMachineName' with IIS Machine name in your environment and assign permissions to this IUSR account on Virtual Directory (read & write, create and delete files).

Hope this helps!

Thanks,

Laxmi Narsimha Rao ORUGANTI, MSFT, SQL Everywhere, Microsoft Corporation

|||I'm having the same problem when I try to use a subscription for MS SQL 2005 I get the same error message. I have tried to use different account including the IUSR_<machinename> but have the same problem.|||

Hi keyboardape. Did you solve your problem?

I met the same issue like your and I solved it today.

Let me know

|||

I am getting this same message! I'm trying to get the AdventureWorks merge replication sample using a mobile device to work.

I have tried both anonymous and authenticated and used various users. Any help? Thanks!

|||

Hi Nick, what was the solution?

initially I had the exactly same error as jonfroehlich ...

the walkthrough goes fine until step 10 of 'create a new subscripition' then it just fails and gives the following error:

--

Failure to connect to SQL Server with provided connection information.
SQL Server does not exist, access is denied because the IIS user is not a valid user on the SQL Server, or the password is incorrect.
HRESULT 0x80004005 (29061)
The operation could not be completed.

--

but after running it again the error msg has changed to ...

--

Initializing SQL Server Reconciler has failed.
HRESULT 0x80045901 (29045)
The process could not connect to Distributor '<mycomputername>.
HRESULT 0x00004E74 (0)The operation could not be completed.
--

I created a new iusr_<computername> account as directed in the walkthrough and have assigned it accordingly...

can you help?

Thanks

|||Hi there
as Laxmi suggested, you do have to set up the IIS and the authentication correctly
try the following:
1. after creating your publication on the management studio, add the user IUSR_<IISMachineName> in the security->login folder
Important: you don't have to create that user, this user already exist, so look it up under advanced search!!
2. rightclick on that user and choose properties
3. under usermappings check the box of the database you would like to access, then click ok
4. rightclick on your publication and choose properties
5. select publication access list an add the IUSR_<IISMachineName> user and click ok
6. rightclick on your publication, select view snapshot status and generate the snapshot

7. execute the web synchronisation wizard (conwizz30.exe) before the subscription wizard!!
this wizard creates the virtual directory for the webaccess, choose annonymous access
8. execute the subscription wizard and use windowsauthentication

the following link helps a lot:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnppcgen/html/med302_msdn_sql_mobile.asp?frame=true

by the way, check the port (settigns-Controlpanel-administrativetool-iis) of your IIS (default is 80) but it might be possible that it's not (if you use skype or such appilations)
if it's not 80 you have to add the port to the url in the WebServer Authentication Step of the Subscription Wizard like 192.168.0.111:81/myVirtDir

Hop it helps
Greets Florian|||

In my case, I got a very similar error message while trying to use SQL server authentication with the 'sa' account.

- Synchronizing Data (100%) (Error)

Messages

* Failure to connect to SQL Server with provided connection information. SQL Server does not exist, access is denied because the SQL user is not a valid user on the SQL Server, or the password is incorrect.

HRESULT 0x80004005 (29060)

It turned out sa account was disabled by default.

|||

I have the same problem. The fix of Florian did not help me.

Any suggestion?

Thanks

GIo

|||

It is Correct.

Thanks. I got the solution. I have created a Word Document to configure step by step.

But, I dont know how to upload it here to help others.

|||

Hi,

Previously I was using Sql mobile in device, that was worked fine with SQL Server 2005. Now as per client's requirement they want the Database in sql ce and sql server 2000.

First of all I would like to know that which are the required cab files for sql ce environment in the device and from where i can get those?

When i see the merge agent, it is connecting Sql server 2000 from sql mobile and it is able to connect the sql server 2000 publisher, but after connecting to publisher when it tries to connect the subscriber it stops with message "Connecting to subscriber WM_Dhaval1". after waiting for 10 minutes the message changes to "The agent is suspect, no response within last 10 minutes" with failed satus. I am sure the problem is with subscriber.

Is sql mobile compatible with sql server 2000? or i have to use sql ce for mobile device explicitely?

|||Was having the same issue. I believe it is caused because I have multiple network cards.

I got this tutorial working, when in the wizard to create a new subscription on the page "choose publication" I selected the aktual server name (my pc name) rather than (local). Then it worked for me.

good luck|||I have the same problem, each time to subscribe the subscription said that the IIS user is not valid SQL Server user. When I create publication on Windows XP the problem is solved, but when I try on Vista the problem go back again. I have create SQL Server login for IUSR and put it into Publication Access List (PAL) of my publication. Is there any user that I must include for IIS 7 or only IUSR.

Sorry I'm really new on discovering IIS 7, for IIS 6 just fine for me.

Thanks,

"Creating a Mobile Application with SQL Server" Tutorial Problem

I am attempting to go through the "Creating a Mobile Application with SQL Server" walkthrough found in the SQL Mobile Books Online help file. Towards the end of this document (under SQL Server Mobile Tasks), they show how to create a new subscription. Unfortunately, after step 10--when you are asked to click finish--I get the following error:

TITLE: Microsoft SQL Server Management Studio

Failure to connect to SQL Server with provided connection information. SQL Server does not exist, access is denied because the IIS user is not a valid user on the SQL Server, or the password is incorrect.
HRESULT 0x80004005 (29061)

One potential area of concern is in setting up the windows authentication login. Step two of "Secure the publication" states "type computername\iusr_computername, where computername is the name of your computer." I was not sure what iusr_computername stood for--should I just type in my windows account for this machine? Or am I to make an account called "isur_computername?"

I just restarted my system and now receive a different error (at the same place):

TITLE: Microsoft SQL Server Management Studio

Authentication failed on the computer running IIS.
HRESULT 0x80070057 (28011)

|||

Hi,

IUSR_<IISMachineName> is an account automatically built-in and would be created automatically when IIS is installed. This is the login account that would be used when you chose the authentication as anonymous. Simply to say, this is anonymous user account. Ofcourse, you can change IIS to use a different account as anonymous account. Now, please replace the 'IISMachineName' with IIS Machine name in your environment and assign permissions to this IUSR account on Virtual Directory (read & write, create and delete files).

Hope this helps!

Thanks,

Laxmi Narsimha Rao ORUGANTI, MSFT, SQL Everywhere, Microsoft Corporation

|||I'm having the same problem when I try to use a subscription for MS SQL 2005 I get the same error message. I have tried to use different account including the IUSR_<machinename> but have the same problem.|||

Hi keyboardape. Did you solve your problem?

I met the same issue like your and I solved it today.

Let me know

|||

I am getting this same message! I'm trying to get the AdventureWorks merge replication sample using a mobile device to work.

I have tried both anonymous and authenticated and used various users. Any help? Thanks!

|||

Hi Nick, what was the solution?

initially I had the exactly same error as jonfroehlich ...

the walkthrough goes fine until step 10 of 'create a new subscripition' then it just fails and gives the following error:

--

Failure to connect to SQL Server with provided connection information.
SQL Server does not exist, access is denied because the IIS user is not a valid user on the SQL Server, or the password is incorrect.
HRESULT 0x80004005 (29061)
The operation could not be completed.

--

but after running it again the error msg has changed to ...

--

Initializing SQL Server Reconciler has failed.
HRESULT 0x80045901 (29045)
The process could not connect to Distributor '<mycomputername>.
HRESULT 0x00004E74 (0)The operation could not be completed.
--

I created a new iusr_<computername> account as directed in the walkthrough and have assigned it accordingly...

can you help?

Thanks

|||Hi there
as Laxmi suggested, you do have to set up the IIS and the authentication correctly
try the following:
1. after creating your publication on the management studio, add the user IUSR_<IISMachineName> in the security->login folder
Important: you don't have to create that user, this user already exist, so look it up under advanced search!!
2. rightclick on that user and choose properties
3. under usermappings check the box of the database you would like to access, then click ok
4. rightclick on your publication and choose properties
5. select publication access list an add the IUSR_<IISMachineName> user and click ok
6. rightclick on your publication, select view snapshot status and generate the snapshot

7. execute the web synchronisation wizard (conwizz30.exe) before the subscription wizard!!
this wizard creates the virtual directory for the webaccess, choose annonymous access
8. execute the subscription wizard and use windowsauthentication

the following link helps a lot:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnppcgen/html/med302_msdn_sql_mobile.asp?frame=true

by the way, check the port (settigns-Controlpanel-administrativetool-iis) of your IIS (default is 80) but it might be possible that it's not (if you use skype or such appilations)
if it's not 80 you have to add the port to the url in the WebServer Authentication Step of the Subscription Wizard like 192.168.0.111:81/myVirtDir

Hop it helps
Greets Florian
|||

In my case, I got a very similar error message while trying to use SQL server authentication with the 'sa' account.

- Synchronizing Data (100%) (Error)

Messages

* Failure to connect to SQL Server with provided connection information. SQL Server does not exist, access is denied because the SQL user is not a valid user on the SQL Server, or the password is incorrect.

HRESULT 0x80004005 (29060)

It turned out sa account was disabled by default.

|||

I have the same problem. The fix of Florian did not help me.

Any suggestion?

Thanks

GIo

|||

It is Correct.

Thanks. I got the solution. I have created a Word Document to configure step by step.

But, I dont know how to upload it here to help others.

|||

Hi,

Previously I was using Sql mobile in device, that was worked fine with SQL Server 2005. Now as per client's requirement they want the Database in sql ce and sql server 2000.

First of all I would like to know that which are the required cab files for sql ce environment in the device and from where i can get those?

When i see the merge agent, it is connecting Sql server 2000 from sql mobile and it is able to connect the sql server 2000 publisher, but after connecting to publisher when it tries to connect the subscriber it stops with message "Connecting to subscriber WM_Dhaval1". after waiting for 10 minutes the message changes to "The agent is suspect, no response within last 10 minutes" with failed satus. I am sure the problem is with subscriber.

Is sql mobile compatible with sql server 2000? or i have to use sql ce for mobile device explicitely?

|||Was having the same issue. I believe it is caused because I have multiple network cards.

I got this tutorial working, when in the wizard to create a new subscription on the page "choose publication" I selected the aktual server name (my pc name) rather than (local). Then it worked for me.

good luck
|||I have the same problem, each time to subscribe the subscription said that the IIS user is not valid SQL Server user. When I create publication on Windows XP the problem is solved, but when I try on Vista the problem go back again. I have create SQL Server login for IUSR and put it into Publication Access List (PAL) of my publication. Is there any user that I must include for IIS 7 or only IUSR.

Sorry I'm really new on discovering IIS 7, for IIS 6 just fine for me.

Thanks,

Saturday, February 11, 2012

#temp tables

I have the following sproc that has been in production for severa months.
When attempting to set this sproc as my data source I get the following error.
There is an error in the query. Implicit conversion from data type
sql_variant to int is not allowed. Use the CONVERT function to run this query.
If I comment most of the sproc except for the create temp table and insert
into it...then it will work (which does me no good).
Please help! I've tried using global temp tables and even just using a
real table that's being populated...but I sitll get the same error.
CREATE proc dbo.spReports_DailySalesSummary @.GroupID int, @.date datetime = null, @.summary bit = 0, @.GroupVal char(1) as
declare @.LastMonth datetime
if @.date is null
set @.date = getdate()
set @.LastMonth = Cast( Cast(Month(@.date) as varchar(2)) + '/1/' +
Cast(year(@.date) as varchar(4)) as datetime)
CREATE TABLE #tmpSalesCounts
(
DayCode tinyint,
SalesRepName varchar(30),
JobCount int,
MailCount int
)
IF @.GroupVal = 'C'
BEGIN
insert into #tmpSalesCounts
select 1 as DayCode, CSRName as SalesRepName, count(*) as JobCount,
sum(jobQuantity) as MailCount
from
(select convert( varchar(14), OrderDate, 107) as OrderDate, CSRName,
JobQuantity
from vwJobs where CSRid in (select SalesRepID from tblSalesRepGroup where
SalesGroupID = @.GroupID ) and orderdate =@.date ) t1
group by CSRName
END
ELSE
BEGIN
insert into #tmpSalesCounts
select 1 as DayCode, SalesRepName, count(*) as JobCount, sum(jobQuantity)
as MailCount
from
(select convert( varchar(14), OrderDate, 107) as OrderDate, SalesRepName,
JobQuantity
from vwJobs where salesrepid in (select SalesRepID from tblSalesRepGroup
where SalesGroupID = @.GroupID ) and orderdate =@.date ) t1
group by SalesRepName
END
IF @.Summary = 0
select t2.SalesRepName, PeriodID, PeriodDesc, isnull(JobCount, 0) Jobs,
isnull(MailCount, 0) as MailPieces
from #tmpSalesCounts t1
right join (select periodID, PeriodDesc, FirstName+' '+LastName as
SalesRepName from tblReportPeriods cross join tblUsers
where Reptype like '%' + @.GroupVal + '%' and UserId in (select SalesRepID
from tblSalesRepGroup where SalesGroupID = @.GroupID ) )
t2 on t1.Daycode = t2.PeriodID and t1.SalesRepname = t2.salesrepname
order by t2.SalesRepName, PeriodID
ELSE
select PeriodID, PeriodDesc, isnull(sum(JobCount), 0) Jobs,
isnull(Sum(MailCount), 0) as MailPieces
from #tmpSalesCounts t1
right join (select periodID, PeriodDesc, FirstName+' '+LastName as
SalesRepName from tblReportPeriods cross join tblUsers
where Reptype like '%' + @.GroupVal + '%' and UserId in (select SalesRepID
from tblSalesRepGroup where SalesGroupID = @.GroupID ) )
t2 on t1.Daycode = t2.PeriodID and t1.SalesRepname = t2.salesrepname
group by PeriodID, PeriodDesc
order by PeriodID
GOFollowing up on my own message. It seems to have something to do with the
creation of the #temp table. I gave the credentials I'm using owner access
to the db, but that does not seem to help.
"FL Jim" wrote:
> I have the following sproc that has been in production for severa months.
> When attempting to set this sproc as my data source I get the following error.
> There is an error in the query. Implicit conversion from data type
> sql_variant to int is not allowed. Use the CONVERT function to run this query.
> If I comment most of the sproc except for the create temp table and insert
> into it...then it will work (which does me no good).
> Please help! I've tried using global temp tables and even just using a
> real table that's being populated...but I sitll get the same error.
>
> CREATE proc dbo.spReports_DailySalesSummary @.GroupID int, @.date datetime => null, @.summary bit = 0, @.GroupVal char(1) as
>
> declare @.LastMonth datetime
> if @.date is null
> set @.date = getdate()
> set @.LastMonth = Cast( Cast(Month(@.date) as varchar(2)) + '/1/' +
> Cast(year(@.date) as varchar(4)) as datetime)
> CREATE TABLE #tmpSalesCounts
> (
> DayCode tinyint,
> SalesRepName varchar(30),
> JobCount int,
> MailCount int
> )
> IF @.GroupVal = 'C'
> BEGIN
> insert into #tmpSalesCounts
> select 1 as DayCode, CSRName as SalesRepName, count(*) as JobCount,
> sum(jobQuantity) as MailCount
> from
> (select convert( varchar(14), OrderDate, 107) as OrderDate, CSRName,
> JobQuantity
> from vwJobs where CSRid in (select SalesRepID from tblSalesRepGroup where
> SalesGroupID = @.GroupID ) and orderdate =@.date ) t1
> group by CSRName
> END
> ELSE
> BEGIN
> insert into #tmpSalesCounts
> select 1 as DayCode, SalesRepName, count(*) as JobCount, sum(jobQuantity)
> as MailCount
> from
> (select convert( varchar(14), OrderDate, 107) as OrderDate, SalesRepName,
> JobQuantity
> from vwJobs where salesrepid in (select SalesRepID from tblSalesRepGroup
> where SalesGroupID = @.GroupID ) and orderdate =@.date ) t1
> group by SalesRepName
> END
>
> IF @.Summary = 0
> select t2.SalesRepName, PeriodID, PeriodDesc, isnull(JobCount, 0) Jobs,
> isnull(MailCount, 0) as MailPieces
> from #tmpSalesCounts t1
> right join (select periodID, PeriodDesc, FirstName+' '+LastName as
> SalesRepName from tblReportPeriods cross join tblUsers
> where Reptype like '%' + @.GroupVal + '%' and UserId in (select SalesRepID
> from tblSalesRepGroup where SalesGroupID = @.GroupID ) )
> t2 on t1.Daycode = t2.PeriodID and t1.SalesRepname = t2.salesrepname
> order by t2.SalesRepName, PeriodID
> ELSE
> select PeriodID, PeriodDesc, isnull(sum(JobCount), 0) Jobs,
> isnull(Sum(MailCount), 0) as MailPieces
> from #tmpSalesCounts t1
> right join (select periodID, PeriodDesc, FirstName+' '+LastName as
> SalesRepName from tblReportPeriods cross join tblUsers
> where Reptype like '%' + @.GroupVal + '%' and UserId in (select SalesRepID
> from tblSalesRepGroup where SalesGroupID = @.GroupID ) )
> t2 on t1.Daycode = t2.PeriodID and t1.SalesRepname = t2.salesrepname
> group by PeriodID, PeriodDesc
> order by PeriodID
> GO
>
>|||Please answer the following question to enable me to help you.
1. Does it work from Query Analyzer?
2. Do you get this error from the data tab or when you try to view it?
3. Is this an error in development or in production?
Bruce Loehle-Conger
MVP SQL Server Reporting Services
"FL Jim" <FLJim@.discussions.microsoft.com> wrote in message
news:A4A39F90-9F48-446E-99DE-E73E9D0A512E@.microsoft.com...
>I have the following sproc that has been in production for severa months.
> When attempting to set this sproc as my data source I get the following
> error.
> There is an error in the query. Implicit conversion from data type
> sql_variant to int is not allowed. Use the CONVERT function to run this
> query.
> If I comment most of the sproc except for the create temp table and insert
> into it...then it will work (which does me no good).
> Please help! I've tried using global temp tables and even just using a
> real table that's being populated...but I sitll get the same error.
>
> CREATE proc dbo.spReports_DailySalesSummary @.GroupID int, @.date datetime => null, @.summary bit = 0, @.GroupVal char(1) as
>
> declare @.LastMonth datetime
> if @.date is null
> set @.date = getdate()
> set @.LastMonth = Cast( Cast(Month(@.date) as varchar(2)) + '/1/' +
> Cast(year(@.date) as varchar(4)) as datetime)
> CREATE TABLE #tmpSalesCounts
> (
> DayCode tinyint,
> SalesRepName varchar(30),
> JobCount int,
> MailCount int
> )
> IF @.GroupVal = 'C'
> BEGIN
> insert into #tmpSalesCounts
> select 1 as DayCode, CSRName as SalesRepName, count(*) as JobCount,
> sum(jobQuantity) as MailCount
> from
> (select convert( varchar(14), OrderDate, 107) as OrderDate, CSRName,
> JobQuantity
> from vwJobs where CSRid in (select SalesRepID from tblSalesRepGroup where
> SalesGroupID = @.GroupID ) and orderdate =@.date ) t1
> group by CSRName
> END
> ELSE
> BEGIN
> insert into #tmpSalesCounts
> select 1 as DayCode, SalesRepName, count(*) as JobCount, sum(jobQuantity)
> as MailCount
> from
> (select convert( varchar(14), OrderDate, 107) as OrderDate, SalesRepName,
> JobQuantity
> from vwJobs where salesrepid in (select SalesRepID from tblSalesRepGroup
> where SalesGroupID = @.GroupID ) and orderdate =@.date ) t1
> group by SalesRepName
> END
>
> IF @.Summary = 0
> select t2.SalesRepName, PeriodID, PeriodDesc, isnull(JobCount, 0) Jobs,
> isnull(MailCount, 0) as MailPieces
> from #tmpSalesCounts t1
> right join (select periodID, PeriodDesc, FirstName+' '+LastName as
> SalesRepName from tblReportPeriods cross join tblUsers
> where Reptype like '%' + @.GroupVal + '%' and UserId in (select SalesRepID
> from tblSalesRepGroup where SalesGroupID = @.GroupID ) )
> t2 on t1.Daycode = t2.PeriodID and t1.SalesRepname = t2.salesrepname
> order by t2.SalesRepName, PeriodID
> ELSE
> select PeriodID, PeriodDesc, isnull(sum(JobCount), 0) Jobs,
> isnull(Sum(MailCount), 0) as MailPieces
> from #tmpSalesCounts t1
> right join (select periodID, PeriodDesc, FirstName+' '+LastName as
> SalesRepName from tblReportPeriods cross join tblUsers
> where Reptype like '%' + @.GroupVal + '%' and UserId in (select SalesRepID
> from tblSalesRepGroup where SalesGroupID = @.GroupID ) )
> t2 on t1.Daycode = t2.PeriodID and t1.SalesRepname = t2.salesrepname
> group by PeriodID, PeriodDesc
> order by PeriodID
> GO
>
>|||1) Yes
2) I was entered in Exec spReports_DailySalesSummary2 @.GroupID, @.date
datetime, @.summary, @.GroupVal when trying to connect to the data source
3) Development.
I found another related thread and have tried their suggestion. I connect
to a table in the db, just to get myself to the Data tab, then switch the
Commany Type to stored procedure and just enter the sproc name. It seems to
work this way. It's rather strange though, because all of my other reports I
was able to just enter the exec sproc (with parameter fields) in the Query
String box of the new report wizard. I guess it's just a quirk...I don't
know.
"Bruce L-C [MVP]" wrote:
> Please answer the following question to enable me to help you.
> 1. Does it work from Query Analyzer?
> 2. Do you get this error from the data tab or when you try to view it?
> 3. Is this an error in development or in production?
>
> --
> Bruce Loehle-Conger
> MVP SQL Server Reporting Services
>
> "FL Jim" <FLJim@.discussions.microsoft.com> wrote in message
> news:A4A39F90-9F48-446E-99DE-E73E9D0A512E@.microsoft.com...
> >I have the following sproc that has been in production for severa months.
> > When attempting to set this sproc as my data source I get the following
> > error.
> >
> > There is an error in the query. Implicit conversion from data type
> > sql_variant to int is not allowed. Use the CONVERT function to run this
> > query.
> >
> > If I comment most of the sproc except for the create temp table and insert
> > into it...then it will work (which does me no good).
> >
> > Please help! I've tried using global temp tables and even just using a
> > real table that's being populated...but I sitll get the same error.
> >
> >
> >
> > CREATE proc dbo.spReports_DailySalesSummary @.GroupID int, @.date datetime => > null, @.summary bit = 0, @.GroupVal char(1) as
> >
> >
> > declare @.LastMonth datetime
> >
> > if @.date is null
> > set @.date = getdate()
> >
> > set @.LastMonth = Cast( Cast(Month(@.date) as varchar(2)) + '/1/' +
> > Cast(year(@.date) as varchar(4)) as datetime)
> >
> > CREATE TABLE #tmpSalesCounts
> > (
> > DayCode tinyint,
> > SalesRepName varchar(30),
> > JobCount int,
> > MailCount int
> > )
> >
> > IF @.GroupVal = 'C'
> > BEGIN
> > insert into #tmpSalesCounts
> > select 1 as DayCode, CSRName as SalesRepName, count(*) as JobCount,
> > sum(jobQuantity) as MailCount
> > from
> > (select convert( varchar(14), OrderDate, 107) as OrderDate, CSRName,
> > JobQuantity
> > from vwJobs where CSRid in (select SalesRepID from tblSalesRepGroup where
> > SalesGroupID = @.GroupID ) and orderdate =@.date ) t1
> >
> > group by CSRName
> >
> > END
> > ELSE
> > BEGIN
> > insert into #tmpSalesCounts
> > select 1 as DayCode, SalesRepName, count(*) as JobCount, sum(jobQuantity)
> > as MailCount
> > from
> > (select convert( varchar(14), OrderDate, 107) as OrderDate, SalesRepName,
> > JobQuantity
> > from vwJobs where salesrepid in (select SalesRepID from tblSalesRepGroup
> > where SalesGroupID = @.GroupID ) and orderdate =@.date ) t1
> >
> > group by SalesRepName
> >
> > END
> >
> >
> > IF @.Summary = 0
> > select t2.SalesRepName, PeriodID, PeriodDesc, isnull(JobCount, 0) Jobs,
> > isnull(MailCount, 0) as MailPieces
> > from #tmpSalesCounts t1
> > right join (select periodID, PeriodDesc, FirstName+' '+LastName as
> > SalesRepName from tblReportPeriods cross join tblUsers
> > where Reptype like '%' + @.GroupVal + '%' and UserId in (select SalesRepID
> > from tblSalesRepGroup where SalesGroupID = @.GroupID ) )
> > t2 on t1.Daycode = t2.PeriodID and t1.SalesRepname = t2.salesrepname
> > order by t2.SalesRepName, PeriodID
> > ELSE
> > select PeriodID, PeriodDesc, isnull(sum(JobCount), 0) Jobs,
> > isnull(Sum(MailCount), 0) as MailPieces
> > from #tmpSalesCounts t1
> > right join (select periodID, PeriodDesc, FirstName+' '+LastName as
> > SalesRepName from tblReportPeriods cross join tblUsers
> > where Reptype like '%' + @.GroupVal + '%' and UserId in (select SalesRepID
> > from tblSalesRepGroup where SalesGroupID = @.GroupID ) )
> > t2 on t1.Daycode = t2.PeriodID and t1.SalesRepname = t2.salesrepname
> > group by PeriodID, PeriodDesc
> > order by PeriodID
> > GO
> >
> >
> >
> >
>
>|||Good. Glad the problem is solved. I use SP a lot but I don't combine the SP
with the wizard. I tend to start with an empty report (add item instead of
add report). Create the dataset calling the SP. Then drop a table on the
layout and drag and drop fields.
Bruce Loehle-Conger
MVP SQL Server Reporting Services
"FL Jim" <FLJim@.discussions.microsoft.com> wrote in message
news:83876B6B-96E6-4BE9-8152-68DDF2D5FBA8@.microsoft.com...
> 1) Yes
> 2) I was entered in Exec spReports_DailySalesSummary2 @.GroupID, @.date
> datetime, @.summary, @.GroupVal when trying to connect to the data source
> 3) Development.
> I found another related thread and have tried their suggestion. I connect
> to a table in the db, just to get myself to the Data tab, then switch the
> Commany Type to stored procedure and just enter the sproc name. It seems
> to
> work this way. It's rather strange though, because all of my other
> reports I
> was able to just enter the exec sproc (with parameter fields) in the Query
> String box of the new report wizard. I guess it's just a quirk...I don't
> know.
> "Bruce L-C [MVP]" wrote:
>> Please answer the following question to enable me to help you.
>> 1. Does it work from Query Analyzer?
>> 2. Do you get this error from the data tab or when you try to view it?
>> 3. Is this an error in development or in production?
>>
>> --
>> Bruce Loehle-Conger
>> MVP SQL Server Reporting Services
>>
>> "FL Jim" <FLJim@.discussions.microsoft.com> wrote in message
>> news:A4A39F90-9F48-446E-99DE-E73E9D0A512E@.microsoft.com...
>> >I have the following sproc that has been in production for severa
>> >months.
>> > When attempting to set this sproc as my data source I get the following
>> > error.
>> >
>> > There is an error in the query. Implicit conversion from data type
>> > sql_variant to int is not allowed. Use the CONVERT function to run this
>> > query.
>> >
>> > If I comment most of the sproc except for the create temp table and
>> > insert
>> > into it...then it will work (which does me no good).
>> >
>> > Please help! I've tried using global temp tables and even just using
>> > a
>> > real table that's being populated...but I sitll get the same error.
>> >
>> >
>> >
>> > CREATE proc dbo.spReports_DailySalesSummary @.GroupID int, @.date
>> > datetime =>> > null, @.summary bit = 0, @.GroupVal char(1) as
>> >
>> >
>> > declare @.LastMonth datetime
>> >
>> > if @.date is null
>> > set @.date = getdate()
>> >
>> > set @.LastMonth = Cast( Cast(Month(@.date) as varchar(2)) + '/1/' +
>> > Cast(year(@.date) as varchar(4)) as datetime)
>> >
>> > CREATE TABLE #tmpSalesCounts
>> > (
>> > DayCode tinyint,
>> > SalesRepName varchar(30),
>> > JobCount int,
>> > MailCount int
>> > )
>> >
>> > IF @.GroupVal = 'C'
>> > BEGIN
>> > insert into #tmpSalesCounts
>> > select 1 as DayCode, CSRName as SalesRepName, count(*) as JobCount,
>> > sum(jobQuantity) as MailCount
>> > from
>> > (select convert( varchar(14), OrderDate, 107) as OrderDate, CSRName,
>> > JobQuantity
>> > from vwJobs where CSRid in (select SalesRepID from tblSalesRepGroup
>> > where
>> > SalesGroupID = @.GroupID ) and orderdate =@.date ) t1
>> >
>> > group by CSRName
>> >
>> > END
>> > ELSE
>> > BEGIN
>> > insert into #tmpSalesCounts
>> > select 1 as DayCode, SalesRepName, count(*) as JobCount,
>> > sum(jobQuantity)
>> > as MailCount
>> > from
>> > (select convert( varchar(14), OrderDate, 107) as OrderDate,
>> > SalesRepName,
>> > JobQuantity
>> > from vwJobs where salesrepid in (select SalesRepID from
>> > tblSalesRepGroup
>> > where SalesGroupID = @.GroupID ) and orderdate =@.date ) t1
>> >
>> > group by SalesRepName
>> >
>> > END
>> >
>> >
>> > IF @.Summary = 0
>> > select t2.SalesRepName, PeriodID, PeriodDesc, isnull(JobCount, 0) Jobs,
>> > isnull(MailCount, 0) as MailPieces
>> > from #tmpSalesCounts t1
>> > right join (select periodID, PeriodDesc, FirstName+' '+LastName as
>> > SalesRepName from tblReportPeriods cross join tblUsers
>> > where Reptype like '%' + @.GroupVal + '%' and UserId in (select
>> > SalesRepID
>> > from tblSalesRepGroup where SalesGroupID = @.GroupID ) )
>> > t2 on t1.Daycode = t2.PeriodID and t1.SalesRepname = t2.salesrepname
>> > order by t2.SalesRepName, PeriodID
>> > ELSE
>> > select PeriodID, PeriodDesc, isnull(sum(JobCount), 0) Jobs,
>> > isnull(Sum(MailCount), 0) as MailPieces
>> > from #tmpSalesCounts t1
>> > right join (select periodID, PeriodDesc, FirstName+' '+LastName as
>> > SalesRepName from tblReportPeriods cross join tblUsers
>> > where Reptype like '%' + @.GroupVal + '%' and UserId in (select
>> > SalesRepID
>> > from tblSalesRepGroup where SalesGroupID = @.GroupID ) )
>> > t2 on t1.Daycode = t2.PeriodID and t1.SalesRepname = t2.salesrepname
>> > group by PeriodID, PeriodDesc
>> > order by PeriodID
>> > GO
>> >
>> >
>> >
>> >
>>|||I thought it was fixed...I failed to realize that while my dataset returns
data in the data tab, I can't see any fields for the sproc in the layout view
for the report. Basically, it's attached and returning data in the data
tab, but the fields are accesible in the report. Back to the drawing board.
I don't know if there's a way to refresh this or not...
"Bruce L-C [MVP]" wrote:
> Good. Glad the problem is solved. I use SP a lot but I don't combine the SP
> with the wizard. I tend to start with an empty report (add item instead of
> add report). Create the dataset calling the SP. Then drop a table on the
> layout and drag and drop fields.
>
> --
> Bruce Loehle-Conger
> MVP SQL Server Reporting Services
> "FL Jim" <FLJim@.discussions.microsoft.com> wrote in message
> news:83876B6B-96E6-4BE9-8152-68DDF2D5FBA8@.microsoft.com...
> > 1) Yes
> > 2) I was entered in Exec spReports_DailySalesSummary2 @.GroupID, @.date
> > datetime, @.summary, @.GroupVal when trying to connect to the data source
> > 3) Development.
> >
> > I found another related thread and have tried their suggestion. I connect
> > to a table in the db, just to get myself to the Data tab, then switch the
> > Commany Type to stored procedure and just enter the sproc name. It seems
> > to
> > work this way. It's rather strange though, because all of my other
> > reports I
> > was able to just enter the exec sproc (with parameter fields) in the Query
> > String box of the new report wizard. I guess it's just a quirk...I don't
> > know.
> >
> > "Bruce L-C [MVP]" wrote:
> >
> >> Please answer the following question to enable me to help you.
> >> 1. Does it work from Query Analyzer?
> >> 2. Do you get this error from the data tab or when you try to view it?
> >> 3. Is this an error in development or in production?
> >>
> >>
> >> --
> >> Bruce Loehle-Conger
> >> MVP SQL Server Reporting Services
> >>
> >>
> >> "FL Jim" <FLJim@.discussions.microsoft.com> wrote in message
> >> news:A4A39F90-9F48-446E-99DE-E73E9D0A512E@.microsoft.com...
> >> >I have the following sproc that has been in production for severa
> >> >months.
> >> > When attempting to set this sproc as my data source I get the following
> >> > error.
> >> >
> >> > There is an error in the query. Implicit conversion from data type
> >> > sql_variant to int is not allowed. Use the CONVERT function to run this
> >> > query.
> >> >
> >> > If I comment most of the sproc except for the create temp table and
> >> > insert
> >> > into it...then it will work (which does me no good).
> >> >
> >> > Please help! I've tried using global temp tables and even just using
> >> > a
> >> > real table that's being populated...but I sitll get the same error.
> >> >
> >> >
> >> >
> >> > CREATE proc dbo.spReports_DailySalesSummary @.GroupID int, @.date
> >> > datetime => >> > null, @.summary bit = 0, @.GroupVal char(1) as
> >> >
> >> >
> >> > declare @.LastMonth datetime
> >> >
> >> > if @.date is null
> >> > set @.date = getdate()
> >> >
> >> > set @.LastMonth = Cast( Cast(Month(@.date) as varchar(2)) + '/1/' +
> >> > Cast(year(@.date) as varchar(4)) as datetime)
> >> >
> >> > CREATE TABLE #tmpSalesCounts
> >> > (
> >> > DayCode tinyint,
> >> > SalesRepName varchar(30),
> >> > JobCount int,
> >> > MailCount int
> >> > )
> >> >
> >> > IF @.GroupVal = 'C'
> >> > BEGIN
> >> > insert into #tmpSalesCounts
> >> > select 1 as DayCode, CSRName as SalesRepName, count(*) as JobCount,
> >> > sum(jobQuantity) as MailCount
> >> > from
> >> > (select convert( varchar(14), OrderDate, 107) as OrderDate, CSRName,
> >> > JobQuantity
> >> > from vwJobs where CSRid in (select SalesRepID from tblSalesRepGroup
> >> > where
> >> > SalesGroupID = @.GroupID ) and orderdate =@.date ) t1
> >> >
> >> > group by CSRName
> >> >
> >> > END
> >> > ELSE
> >> > BEGIN
> >> > insert into #tmpSalesCounts
> >> > select 1 as DayCode, SalesRepName, count(*) as JobCount,
> >> > sum(jobQuantity)
> >> > as MailCount
> >> > from
> >> > (select convert( varchar(14), OrderDate, 107) as OrderDate,
> >> > SalesRepName,
> >> > JobQuantity
> >> > from vwJobs where salesrepid in (select SalesRepID from
> >> > tblSalesRepGroup
> >> > where SalesGroupID = @.GroupID ) and orderdate =@.date ) t1
> >> >
> >> > group by SalesRepName
> >> >
> >> > END
> >> >
> >> >
> >> > IF @.Summary = 0
> >> > select t2.SalesRepName, PeriodID, PeriodDesc, isnull(JobCount, 0) Jobs,
> >> > isnull(MailCount, 0) as MailPieces
> >> > from #tmpSalesCounts t1
> >> > right join (select periodID, PeriodDesc, FirstName+' '+LastName as
> >> > SalesRepName from tblReportPeriods cross join tblUsers
> >> > where Reptype like '%' + @.GroupVal + '%' and UserId in (select
> >> > SalesRepID
> >> > from tblSalesRepGroup where SalesGroupID = @.GroupID ) )
> >> > t2 on t1.Daycode = t2.PeriodID and t1.SalesRepname = t2.salesrepname
> >> > order by t2.SalesRepName, PeriodID
> >> > ELSE
> >> > select PeriodID, PeriodDesc, isnull(sum(JobCount), 0) Jobs,
> >> > isnull(Sum(MailCount), 0) as MailPieces
> >> > from #tmpSalesCounts t1
> >> > right join (select periodID, PeriodDesc, FirstName+' '+LastName as
> >> > SalesRepName from tblReportPeriods cross join tblUsers
> >> > where Reptype like '%' + @.GroupVal + '%' and UserId in (select
> >> > SalesRepID
> >> > from tblSalesRepGroup where SalesGroupID = @.GroupID ) )
> >> > t2 on t1.Daycode = t2.PeriodID and t1.SalesRepname = t2.salesrepname
> >> > group by PeriodID, PeriodDesc
> >> > order by PeriodID
> >> > GO
> >> >
> >> >
> >> >
> >> >
> >>
> >>
> >>
>
>|||Yes. Click on the refresh fields button to the right of the ... in the data
tab (it looks like the refresh button for IE).
Bruce Loehle-Conger
MVP SQL Server Reporting Services
"FL Jim" <FLJim@.discussions.microsoft.com> wrote in message
news:4FBB92FE-95CE-4FC5-9918-C9B26081895B@.microsoft.com...
>I thought it was fixed...I failed to realize that while my dataset returns
> data in the data tab, I can't see any fields for the sproc in the layout
> view
> for the report. Basically, it's attached and returning data in the data
> tab, but the fields are accesible in the report. Back to the drawing
> board.
> I don't know if there's a way to refresh this or not...
> "Bruce L-C [MVP]" wrote:
>> Good. Glad the problem is solved. I use SP a lot but I don't combine the
>> SP
>> with the wizard. I tend to start with an empty report (add item instead
>> of
>> add report). Create the dataset calling the SP. Then drop a table on the
>> layout and drag and drop fields.
>>
>> --
>> Bruce Loehle-Conger
>> MVP SQL Server Reporting Services
>> "FL Jim" <FLJim@.discussions.microsoft.com> wrote in message
>> news:83876B6B-96E6-4BE9-8152-68DDF2D5FBA8@.microsoft.com...
>> > 1) Yes
>> > 2) I was entered in Exec spReports_DailySalesSummary2 @.GroupID, @.date
>> > datetime, @.summary, @.GroupVal when trying to connect to the data source
>> > 3) Development.
>> >
>> > I found another related thread and have tried their suggestion. I
>> > connect
>> > to a table in the db, just to get myself to the Data tab, then switch
>> > the
>> > Commany Type to stored procedure and just enter the sproc name. It
>> > seems
>> > to
>> > work this way. It's rather strange though, because all of my other
>> > reports I
>> > was able to just enter the exec sproc (with parameter fields) in the
>> > Query
>> > String box of the new report wizard. I guess it's just a quirk...I
>> > don't
>> > know.
>> >
>> > "Bruce L-C [MVP]" wrote:
>> >
>> >> Please answer the following question to enable me to help you.
>> >> 1. Does it work from Query Analyzer?
>> >> 2. Do you get this error from the data tab or when you try to view it?
>> >> 3. Is this an error in development or in production?
>> >>
>> >>
>> >> --
>> >> Bruce Loehle-Conger
>> >> MVP SQL Server Reporting Services
>> >>
>> >>
>> >> "FL Jim" <FLJim@.discussions.microsoft.com> wrote in message
>> >> news:A4A39F90-9F48-446E-99DE-E73E9D0A512E@.microsoft.com...
>> >> >I have the following sproc that has been in production for severa
>> >> >months.
>> >> > When attempting to set this sproc as my data source I get the
>> >> > following
>> >> > error.
>> >> >
>> >> > There is an error in the query. Implicit conversion from data type
>> >> > sql_variant to int is not allowed. Use the CONVERT function to run
>> >> > this
>> >> > query.
>> >> >
>> >> > If I comment most of the sproc except for the create temp table and
>> >> > insert
>> >> > into it...then it will work (which does me no good).
>> >> >
>> >> > Please help! I've tried using global temp tables and even just
>> >> > using
>> >> > a
>> >> > real table that's being populated...but I sitll get the same error.
>> >> >
>> >> >
>> >> >
>> >> > CREATE proc dbo.spReports_DailySalesSummary @.GroupID int, @.date
>> >> > datetime =>> >> > null, @.summary bit = 0, @.GroupVal char(1) as
>> >> >
>> >> >
>> >> > declare @.LastMonth datetime
>> >> >
>> >> > if @.date is null
>> >> > set @.date = getdate()
>> >> >
>> >> > set @.LastMonth = Cast( Cast(Month(@.date) as varchar(2)) + '/1/' +
>> >> > Cast(year(@.date) as varchar(4)) as datetime)
>> >> >
>> >> > CREATE TABLE #tmpSalesCounts
>> >> > (
>> >> > DayCode tinyint,
>> >> > SalesRepName varchar(30),
>> >> > JobCount int,
>> >> > MailCount int
>> >> > )
>> >> >
>> >> > IF @.GroupVal = 'C'
>> >> > BEGIN
>> >> > insert into #tmpSalesCounts
>> >> > select 1 as DayCode, CSRName as SalesRepName, count(*) as JobCount,
>> >> > sum(jobQuantity) as MailCount
>> >> > from
>> >> > (select convert( varchar(14), OrderDate, 107) as OrderDate, CSRName,
>> >> > JobQuantity
>> >> > from vwJobs where CSRid in (select SalesRepID from tblSalesRepGroup
>> >> > where
>> >> > SalesGroupID = @.GroupID ) and orderdate =@.date ) t1
>> >> >
>> >> > group by CSRName
>> >> >
>> >> > END
>> >> > ELSE
>> >> > BEGIN
>> >> > insert into #tmpSalesCounts
>> >> > select 1 as DayCode, SalesRepName, count(*) as JobCount,
>> >> > sum(jobQuantity)
>> >> > as MailCount
>> >> > from
>> >> > (select convert( varchar(14), OrderDate, 107) as OrderDate,
>> >> > SalesRepName,
>> >> > JobQuantity
>> >> > from vwJobs where salesrepid in (select SalesRepID from
>> >> > tblSalesRepGroup
>> >> > where SalesGroupID = @.GroupID ) and orderdate =@.date ) t1
>> >> >
>> >> > group by SalesRepName
>> >> >
>> >> > END
>> >> >
>> >> >
>> >> > IF @.Summary = 0
>> >> > select t2.SalesRepName, PeriodID, PeriodDesc, isnull(JobCount, 0)
>> >> > Jobs,
>> >> > isnull(MailCount, 0) as MailPieces
>> >> > from #tmpSalesCounts t1
>> >> > right join (select periodID, PeriodDesc, FirstName+' '+LastName as
>> >> > SalesRepName from tblReportPeriods cross join tblUsers
>> >> > where Reptype like '%' + @.GroupVal + '%' and UserId in (select
>> >> > SalesRepID
>> >> > from tblSalesRepGroup where SalesGroupID = @.GroupID ) )
>> >> > t2 on t1.Daycode = t2.PeriodID and t1.SalesRepname = t2.salesrepname
>> >> > order by t2.SalesRepName, PeriodID
>> >> > ELSE
>> >> > select PeriodID, PeriodDesc, isnull(sum(JobCount), 0) Jobs,
>> >> > isnull(Sum(MailCount), 0) as MailPieces
>> >> > from #tmpSalesCounts t1
>> >> > right join (select periodID, PeriodDesc, FirstName+' '+LastName as
>> >> > SalesRepName from tblReportPeriods cross join tblUsers
>> >> > where Reptype like '%' + @.GroupVal + '%' and UserId in (select
>> >> > SalesRepID
>> >> > from tblSalesRepGroup where SalesGroupID = @.GroupID ) )
>> >> > t2 on t1.Daycode = t2.PeriodID and t1.SalesRepname = t2.salesrepname
>> >> > group by PeriodID, PeriodDesc
>> >> > order by PeriodID
>> >> > GO
>> >> >
>> >> >
>> >> >
>> >> >
>> >>
>> >>
>> >>
>>|||I recall way back when RS was in beta that SET NOCOUNT ON would often fix
this soft of problem, the code you gave in your sproc did not have this I
wonder if you could try adding this and see.
Regards
K Duncan
"FL Jim" <FLJim@.discussions.microsoft.com> wrote in message
news:4FBB92FE-95CE-4FC5-9918-C9B26081895B@.microsoft.com...
>I thought it was fixed...I failed to realize that while my dataset returns
> data in the data tab, I can't see any fields for the sproc in the layout
> view
> for the report. Basically, it's attached and returning data in the data
> tab, but the fields are accesible in the report. Back to the drawing
> board.
> I don't know if there's a way to refresh this or not...
> "Bruce L-C [MVP]" wrote:
>> Good. Glad the problem is solved. I use SP a lot but I don't combine the
>> SP
>> with the wizard. I tend to start with an empty report (add item instead
>> of
>> add report). Create the dataset calling the SP. Then drop a table on the
>> layout and drag and drop fields.
>>
>> --
>> Bruce Loehle-Conger
>> MVP SQL Server Reporting Services
>> "FL Jim" <FLJim@.discussions.microsoft.com> wrote in message
>> news:83876B6B-96E6-4BE9-8152-68DDF2D5FBA8@.microsoft.com...
>> > 1) Yes
>> > 2) I was entered in Exec spReports_DailySalesSummary2 @.GroupID, @.date
>> > datetime, @.summary, @.GroupVal when trying to connect to the data source
>> > 3) Development.
>> >
>> > I found another related thread and have tried their suggestion. I
>> > connect
>> > to a table in the db, just to get myself to the Data tab, then switch
>> > the
>> > Commany Type to stored procedure and just enter the sproc name. It
>> > seems
>> > to
>> > work this way. It's rather strange though, because all of my other
>> > reports I
>> > was able to just enter the exec sproc (with parameter fields) in the
>> > Query
>> > String box of the new report wizard. I guess it's just a quirk...I
>> > don't
>> > know.
>> >
>> > "Bruce L-C [MVP]" wrote:
>> >
>> >> Please answer the following question to enable me to help you.
>> >> 1. Does it work from Query Analyzer?
>> >> 2. Do you get this error from the data tab or when you try to view it?
>> >> 3. Is this an error in development or in production?
>> >>
>> >>
>> >> --
>> >> Bruce Loehle-Conger
>> >> MVP SQL Server Reporting Services
>> >>
>> >>
>> >> "FL Jim" <FLJim@.discussions.microsoft.com> wrote in message
>> >> news:A4A39F90-9F48-446E-99DE-E73E9D0A512E@.microsoft.com...
>> >> >I have the following sproc that has been in production for severa
>> >> >months.
>> >> > When attempting to set this sproc as my data source I get the
>> >> > following
>> >> > error.
>> >> >
>> >> > There is an error in the query. Implicit conversion from data type
>> >> > sql_variant to int is not allowed. Use the CONVERT function to run
>> >> > this
>> >> > query.
>> >> >
>> >> > If I comment most of the sproc except for the create temp table and
>> >> > insert
>> >> > into it...then it will work (which does me no good).
>> >> >
>> >> > Please help! I've tried using global temp tables and even just
>> >> > using
>> >> > a
>> >> > real table that's being populated...but I sitll get the same error.
>> >> >
>> >> >
>> >> >
>> >> > CREATE proc dbo.spReports_DailySalesSummary @.GroupID int, @.date
>> >> > datetime =>> >> > null, @.summary bit = 0, @.GroupVal char(1) as
>> >> >
>> >> >
>> >> > declare @.LastMonth datetime
>> >> >
>> >> > if @.date is null
>> >> > set @.date = getdate()
>> >> >
>> >> > set @.LastMonth = Cast( Cast(Month(@.date) as varchar(2)) + '/1/' +
>> >> > Cast(year(@.date) as varchar(4)) as datetime)
>> >> >
>> >> > CREATE TABLE #tmpSalesCounts
>> >> > (
>> >> > DayCode tinyint,
>> >> > SalesRepName varchar(30),
>> >> > JobCount int,
>> >> > MailCount int
>> >> > )
>> >> >
>> >> > IF @.GroupVal = 'C'
>> >> > BEGIN
>> >> > insert into #tmpSalesCounts
>> >> > select 1 as DayCode, CSRName as SalesRepName, count(*) as JobCount,
>> >> > sum(jobQuantity) as MailCount
>> >> > from
>> >> > (select convert( varchar(14), OrderDate, 107) as OrderDate, CSRName,
>> >> > JobQuantity
>> >> > from vwJobs where CSRid in (select SalesRepID from tblSalesRepGroup
>> >> > where
>> >> > SalesGroupID = @.GroupID ) and orderdate =@.date ) t1
>> >> >
>> >> > group by CSRName
>> >> >
>> >> > END
>> >> > ELSE
>> >> > BEGIN
>> >> > insert into #tmpSalesCounts
>> >> > select 1 as DayCode, SalesRepName, count(*) as JobCount,
>> >> > sum(jobQuantity)
>> >> > as MailCount
>> >> > from
>> >> > (select convert( varchar(14), OrderDate, 107) as OrderDate,
>> >> > SalesRepName,
>> >> > JobQuantity
>> >> > from vwJobs where salesrepid in (select SalesRepID from
>> >> > tblSalesRepGroup
>> >> > where SalesGroupID = @.GroupID ) and orderdate =@.date ) t1
>> >> >
>> >> > group by SalesRepName
>> >> >
>> >> > END
>> >> >
>> >> >
>> >> > IF @.Summary = 0
>> >> > select t2.SalesRepName, PeriodID, PeriodDesc, isnull(JobCount, 0)
>> >> > Jobs,
>> >> > isnull(MailCount, 0) as MailPieces
>> >> > from #tmpSalesCounts t1
>> >> > right join (select periodID, PeriodDesc, FirstName+' '+LastName as
>> >> > SalesRepName from tblReportPeriods cross join tblUsers
>> >> > where Reptype like '%' + @.GroupVal + '%' and UserId in (select
>> >> > SalesRepID
>> >> > from tblSalesRepGroup where SalesGroupID = @.GroupID ) )
>> >> > t2 on t1.Daycode = t2.PeriodID and t1.SalesRepname = t2.salesrepname
>> >> > order by t2.SalesRepName, PeriodID
>> >> > ELSE
>> >> > select PeriodID, PeriodDesc, isnull(sum(JobCount), 0) Jobs,
>> >> > isnull(Sum(MailCount), 0) as MailPieces
>> >> > from #tmpSalesCounts t1
>> >> > right join (select periodID, PeriodDesc, FirstName+' '+LastName as
>> >> > SalesRepName from tblReportPeriods cross join tblUsers
>> >> > where Reptype like '%' + @.GroupVal + '%' and UserId in (select
>> >> > SalesRepID
>> >> > from tblSalesRepGroup where SalesGroupID = @.GroupID ) )
>> >> > t2 on t1.Daycode = t2.PeriodID and t1.SalesRepname = t2.salesrepname
>> >> > group by PeriodID, PeriodDesc
>> >> > order by PeriodID
>> >> > GO
>> >> >
>> >> >
>> >> >
>> >> >
>> >>
>> >>
>> >>
>>|||If you can return data in the data tab then you will be fine. All you need
to do is click on the (not very discoverable) refresh fields button. It is
to the right of the ..., looks like the refresh button for IE.
Bruce Loehle-Conger
MVP SQL Server Reporting Services
"K Duncan" <keith@.sourcearray.com> wrote in message
news:%231xTouL1FHA.2792@.tk2msftngp13.phx.gbl...
>I recall way back when RS was in beta that SET NOCOUNT ON would often fix
>this soft of problem, the code you gave in your sproc did not have this I
>wonder if you could try adding this and see.
> Regards
> K Duncan
>
> "FL Jim" <FLJim@.discussions.microsoft.com> wrote in message
> news:4FBB92FE-95CE-4FC5-9918-C9B26081895B@.microsoft.com...
>>I thought it was fixed...I failed to realize that while my dataset returns
>> data in the data tab, I can't see any fields for the sproc in the layout
>> view
>> for the report. Basically, it's attached and returning data in the data
>> tab, but the fields are accesible in the report. Back to the drawing
>> board.
>> I don't know if there's a way to refresh this or not...
>> "Bruce L-C [MVP]" wrote:
>> Good. Glad the problem is solved. I use SP a lot but I don't combine the
>> SP
>> with the wizard. I tend to start with an empty report (add item instead
>> of
>> add report). Create the dataset calling the SP. Then drop a table on the
>> layout and drag and drop fields.
>>
>> --
>> Bruce Loehle-Conger
>> MVP SQL Server Reporting Services
>> "FL Jim" <FLJim@.discussions.microsoft.com> wrote in message
>> news:83876B6B-96E6-4BE9-8152-68DDF2D5FBA8@.microsoft.com...
>> > 1) Yes
>> > 2) I was entered in Exec spReports_DailySalesSummary2 @.GroupID, @.date
>> > datetime, @.summary, @.GroupVal when trying to connect to the data
>> > source
>> > 3) Development.
>> >
>> > I found another related thread and have tried their suggestion. I
>> > connect
>> > to a table in the db, just to get myself to the Data tab, then switch
>> > the
>> > Commany Type to stored procedure and just enter the sproc name. It
>> > seems
>> > to
>> > work this way. It's rather strange though, because all of my other
>> > reports I
>> > was able to just enter the exec sproc (with parameter fields) in the
>> > Query
>> > String box of the new report wizard. I guess it's just a quirk...I
>> > don't
>> > know.
>> >
>> > "Bruce L-C [MVP]" wrote:
>> >
>> >> Please answer the following question to enable me to help you.
>> >> 1. Does it work from Query Analyzer?
>> >> 2. Do you get this error from the data tab or when you try to view
>> >> it?
>> >> 3. Is this an error in development or in production?
>> >>
>> >>
>> >> --
>> >> Bruce Loehle-Conger
>> >> MVP SQL Server Reporting Services
>> >>
>> >>
>> >> "FL Jim" <FLJim@.discussions.microsoft.com> wrote in message
>> >> news:A4A39F90-9F48-446E-99DE-E73E9D0A512E@.microsoft.com...
>> >> >I have the following sproc that has been in production for severa
>> >> >months.
>> >> > When attempting to set this sproc as my data source I get the
>> >> > following
>> >> > error.
>> >> >
>> >> > There is an error in the query. Implicit conversion from data type
>> >> > sql_variant to int is not allowed. Use the CONVERT function to run
>> >> > this
>> >> > query.
>> >> >
>> >> > If I comment most of the sproc except for the create temp table and
>> >> > insert
>> >> > into it...then it will work (which does me no good).
>> >> >
>> >> > Please help! I've tried using global temp tables and even just
>> >> > using
>> >> > a
>> >> > real table that's being populated...but I sitll get the same error.
>> >> >
>> >> >
>> >> >
>> >> > CREATE proc dbo.spReports_DailySalesSummary @.GroupID int, @.date
>> >> > datetime =>> >> > null, @.summary bit = 0, @.GroupVal char(1) as
>> >> >
>> >> >
>> >> > declare @.LastMonth datetime
>> >> >
>> >> > if @.date is null
>> >> > set @.date = getdate()
>> >> >
>> >> > set @.LastMonth = Cast( Cast(Month(@.date) as varchar(2)) + '/1/' +
>> >> > Cast(year(@.date) as varchar(4)) as datetime)
>> >> >
>> >> > CREATE TABLE #tmpSalesCounts
>> >> > (
>> >> > DayCode tinyint,
>> >> > SalesRepName varchar(30),
>> >> > JobCount int,
>> >> > MailCount int
>> >> > )
>> >> >
>> >> > IF @.GroupVal = 'C'
>> >> > BEGIN
>> >> > insert into #tmpSalesCounts
>> >> > select 1 as DayCode, CSRName as SalesRepName, count(*) as JobCount,
>> >> > sum(jobQuantity) as MailCount
>> >> > from
>> >> > (select convert( varchar(14), OrderDate, 107) as OrderDate,
>> >> > CSRName,
>> >> > JobQuantity
>> >> > from vwJobs where CSRid in (select SalesRepID from tblSalesRepGroup
>> >> > where
>> >> > SalesGroupID = @.GroupID ) and orderdate =@.date ) t1
>> >> >
>> >> > group by CSRName
>> >> >
>> >> > END
>> >> > ELSE
>> >> > BEGIN
>> >> > insert into #tmpSalesCounts
>> >> > select 1 as DayCode, SalesRepName, count(*) as JobCount,
>> >> > sum(jobQuantity)
>> >> > as MailCount
>> >> > from
>> >> > (select convert( varchar(14), OrderDate, 107) as OrderDate,
>> >> > SalesRepName,
>> >> > JobQuantity
>> >> > from vwJobs where salesrepid in (select SalesRepID from
>> >> > tblSalesRepGroup
>> >> > where SalesGroupID = @.GroupID ) and orderdate =@.date ) t1
>> >> >
>> >> > group by SalesRepName
>> >> >
>> >> > END
>> >> >
>> >> >
>> >> > IF @.Summary = 0
>> >> > select t2.SalesRepName, PeriodID, PeriodDesc, isnull(JobCount, 0)
>> >> > Jobs,
>> >> > isnull(MailCount, 0) as MailPieces
>> >> > from #tmpSalesCounts t1
>> >> > right join (select periodID, PeriodDesc, FirstName+' '+LastName as
>> >> > SalesRepName from tblReportPeriods cross join tblUsers
>> >> > where Reptype like '%' + @.GroupVal + '%' and UserId in (select
>> >> > SalesRepID
>> >> > from tblSalesRepGroup where SalesGroupID = @.GroupID ) )
>> >> > t2 on t1.Daycode = t2.PeriodID and t1.SalesRepname =>> >> > t2.salesrepname
>> >> > order by t2.SalesRepName, PeriodID
>> >> > ELSE
>> >> > select PeriodID, PeriodDesc, isnull(sum(JobCount), 0) Jobs,
>> >> > isnull(Sum(MailCount), 0) as MailPieces
>> >> > from #tmpSalesCounts t1
>> >> > right join (select periodID, PeriodDesc, FirstName+' '+LastName as
>> >> > SalesRepName from tblReportPeriods cross join tblUsers
>> >> > where Reptype like '%' + @.GroupVal + '%' and UserId in (select
>> >> > SalesRepID
>> >> > from tblSalesRepGroup where SalesGroupID = @.GroupID ) )
>> >> > t2 on t1.Daycode = t2.PeriodID and t1.SalesRepname =>> >> > t2.salesrepname
>> >> > group by PeriodID, PeriodDesc
>> >> > order by PeriodID
>> >> > GO
>> >> >
>> >> >
>> >> >
>> >> >
>> >>
>> >>
>> >>
>>
>