Showing posts with label agent. Show all posts
Showing posts with label agent. Show all posts

Friday, March 30, 2012

question about selecting records

I have a mssql database like this:

Table1:
ID GuestName Agent CheckInDate OtherColumn
1 Guest 1 Peter 1/11/2005 whatever
2 Guest 2 Peter 1/11/2005 whatever
3 Guest 3 John 1/11/2005 whatever
4 Guest 4 John 1/13/2005 whatever
5 Guest 5 Peter 1/11/2005 whatever

I want to display it group by same Agent and CheckInDate. Like this:

Agent CheckInDate Records
Peter 1/11/2005 3
John 1/11/2005 1
John 1/13/2005 1

How can I do this? Please help, thank you.

select agent,checkindate,count(agent) Records
from <table>
group by agent,checkindate
|||Thank you. And there's another question. The CheckInDate values has time value in it. for example, 1/11/2005 1:15:45PM. If I use GROUP BY CheckInDate, the time value matters. How can ingore time value and just GROUP BY date value?|||cast or convert it to a varchar|||CONVERT(VARCHAR(12), myDateColumn, 101)

Wednesday, March 28, 2012

Question about restore replication database

Hi Guys,
I got a trouble that I tried to restore a database that has a replication
created on and I got an error after restore. In log reader agent and
distribution agent became red color and error message like "Could not execute
sp_repldone/sp_replcounters.." Sorry I cannot remember error message
exactly, and I am unable to restart the agent. I guess the reason might be
that I didn't restore distributiuon because I didn't backup this database. Do
I need to restore distribution databse when I restore publication database?
thanks.
Ideally your publication and distribution database would be in lock step by
using the sync with backup option.
Otherwise you should use sp_replrestart to get around problems like this.
Hilary Cotter
Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602.html
Looking for a FAQ on Indexing Services/SQL FTS
http://www.indexserverfaq.com
"Iter" <Iter@.discussions.microsoft.com> wrote in message
news:63B4A13A-87EC-48B3-8867-EBD74B228A24@.microsoft.com...
> Hi Guys,
> I got a trouble that I tried to restore a database that has a replication
> created on and I got an error after restore. In log reader agent and
> distribution agent became red color and error message like "Could not
> execute
> sp_repldone/sp_replcounters.." Sorry I cannot remember error message
> exactly, and I am unable to restart the agent. I guess the reason might be
> that I didn't restore distributiuon because I didn't backup this database.
> Do
> I need to restore distribution databse when I restore publication
> database?
> thanks.
>
|||What is "sync with backup option"? Also, I looked in BOL and could not find
sp_replrestart. I am interested in this because we are seeting up a new
merge publication and am interested in how it affects backup/restore.
Thanks.
David
"Hilary Cotter" <hilary.cotter@.gmail.com> wrote in message
news:%23GOSOVNOHHA.780@.TK2MSFTNGP03.phx.gbl...
> Ideally your publication and distribution database would be in lock step
> by using the sync with backup option.
> Otherwise you should use sp_replrestart to get around problems like this.
> --
> Hilary Cotter
> Looking for a SQL Server replication book?
> http://www.nwsu.com/0974973602.html
> Looking for a FAQ on Indexing Services/SQL FTS
> http://www.indexserverfaq.com
>
> "Iter" <Iter@.discussions.microsoft.com> wrote in message
> news:63B4A13A-87EC-48B3-8867-EBD74B228A24@.microsoft.com...
>
|||This is for transactional replication and not merge replication.
for more info on sync with backup consult -
http://msdn2.microsoft.com/en-us/library/aa237094(SQL.80).aspx
for more info repl_restart consult
http://msdn2.microsoft.com/en-us/library/ms174390.aspx
Hilary Cotter
Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602.html
Looking for a FAQ on Indexing Services/SQL FTS
http://www.indexserverfaq.com
"David Chase" <dlchase@.lifetimeinc.com> wrote in message
news:%234Q6oLPOHHA.2232@.TK2MSFTNGP02.phx.gbl...
> What is "sync with backup option"? Also, I looked in BOL and could not
> find sp_replrestart. I am interested in this because we are seeting up a
> new merge publication and am interested in how it affects backup/restore.
> Thanks.
> David
> "Hilary Cotter" <hilary.cotter@.gmail.com> wrote in message
> news:%23GOSOVNOHHA.780@.TK2MSFTNGP03.phx.gbl...
>

Friday, March 23, 2012

Question about Merge Agent

Does anyone know of a reasource that will describe exactly what happens during merge replication. I particular, I would like to know what is happening when the merge agent history says "Downloaded xxx data changes". Where is it downloading it to?
Downloaded refers to Publisher->Subscriber changes, while uploaded is the converse (information stored in dbo.MSmerge_history). To get further information on this and related topics, BOL is currently the best resource. Have a look at 'merge replication, o
verview' as a good page to navigate from.
HTH,
Paul Ibison
sql