Showing posts with label following. Show all posts
Showing posts with label following. Show all posts

Wednesday, March 28, 2012

Putting calculated value into excel

I'm using VB to write some data to an Excel spreadsheet.
I use the following vb/sql statement to get the data I need:
ADO_rs.Source = "select least(2+(0.044117*CT_OFF_GEN),8)/count(*)as mydata2
calculate avg from """ + "6b_NRatio" + """.1 where ct_text like 'on/off
it produces the following correct output:
ct_off_time mydata2
-- --
05-MAY-03 18:57:57.7 1.97044
24-JAN-03 11:46:07.8 8
16-AUG-03 09:58:27.9 5.30701
......
16-AUG-03 21:22:57.7 6.09582
10-DEC-02 16:46:37.6 8
--
AVG 5.25773
If I could change the above code where I could store the "calculate avg as
mydata3" I could then put the data into excel.
But I can't do this
How can I store the AVG 5.25773 into a variable so I can use it in Excel
like so:
ADO_rs.Open
ActiveCell.Offset(x, 5).Value = ADO_rs.Fields!AVG GOES HERE
Maybe there is an easier way to do this' Any suggestions'
DavidHi
This seems to be very Excel specific SQL and therefore not really covered by
SQL server!
At a guess you will need to move the Average function into the select
columns
John
"Aster99" <Aster99@.home.net> wrote in message
news:%23igwDlOKEHA.204@.TK2MSFTNGP10.phx.gbl...
> I'm using VB to write some data to an Excel spreadsheet.
> I use the following vb/sql statement to get the data I need:
> ADO_rs.Source = "select least(2+(0.044117*CT_OFF_GEN),8)/count(*)as
mydata2
> calculate avg from """ + "6b_NRatio" + """.1 where ct_text like 'on/off
> it produces the following correct output:
> ct_off_time mydata2
> -- --
> 05-MAY-03 18:57:57.7 1.97044
> 24-JAN-03 11:46:07.8 8
> 16-AUG-03 09:58:27.9 5.30701
> ......
> 16-AUG-03 21:22:57.7 6.09582
> 10-DEC-02 16:46:37.6 8
> --
> AVG 5.25773
> If I could change the above code where I could store the "calculate avg as
> mydata3" I could then put the data into excel.
> But I can't do this
> How can I store the AVG 5.25773 into a variable so I can use it in Excel
> like so:
> ADO_rs.Open
> ActiveCell.Offset(x, 5).Value = ADO_rs.Fields!AVG GOES HERE
> Maybe there is an easier way to do this' Any suggestions'
> David
>sql

Putting calculated value into excel

I'm using VB to write some data to an Excel spreadsheet.
I use the following vb/sql statement to get the data I need:
ADO_rs.Source = "select least(2+(0.044117*CT_OFF_GEN),8)/count(*)as mydata2
calculate avg from """ + "6b_NRatio" + """.1 where ct_text like 'on/off
it produces the following correct output:
ct_off_time mydata2
-- --
05-MAY-03 18:57:57.7 1.97044
24-JAN-03 11:46:07.8 8
16-AUG-03 09:58:27.9 5.30701
......
16-AUG-03 21:22:57.7 6.09582
10-DEC-02 16:46:37.6 8
--
AVG 5.25773
If I could change the above code where I could store the "calculate avg as
mydata3" I could then put the data into excel.
But I can't do this :(
How can I store the AVG 5.25773 into a variable so I can use it in Excel
like so:
ADO_rs.Open
ActiveCell.Offset(x, 5).Value = ADO_rs.Fields!AVG GOES HERE
Maybe there is an easier way to do this' Any suggestions'
DavidHi
This seems to be very Excel specific SQL and therefore not really covered by
SQL server!
At a guess you will need to move the Average function into the select
columns
John
"Aster99" <Aster99@.home.net> wrote in message
news:%23igwDlOKEHA.204@.TK2MSFTNGP10.phx.gbl...
> I'm using VB to write some data to an Excel spreadsheet.
> I use the following vb/sql statement to get the data I need:
> ADO_rs.Source = "select least(2+(0.044117*CT_OFF_GEN),8)/count(*)as
mydata2
> calculate avg from """ + "6b_NRatio" + """.1 where ct_text like 'on/off
> it produces the following correct output:
> ct_off_time mydata2
> -- --
> 05-MAY-03 18:57:57.7 1.97044
> 24-JAN-03 11:46:07.8 8
> 16-AUG-03 09:58:27.9 5.30701
> ......
> 16-AUG-03 21:22:57.7 6.09582
> 10-DEC-02 16:46:37.6 8
> --
> AVG 5.25773
> If I could change the above code where I could store the "calculate avg as
> mydata3" I could then put the data into excel.
> But I can't do this :(
> How can I store the AVG 5.25773 into a variable so I can use it in Excel
> like so:
> ADO_rs.Open
> ActiveCell.Offset(x, 5).Value = ADO_rs.Fields!AVG GOES HERE
> Maybe there is an easier way to do this' Any suggestions'
> David
>

Putting calculated value into excel

I'm using VB to write some data to an Excel spreadsheet.
I use the following vb/sql statement to get the data I need:
ADO_rs.Source = "select least(2+(0.044117*CT_OFF_GEN),8)/count(*)as mydata2
calculate avg from """ + "6b_NRatio" + """.1 where ct_text like 'on/off
it produces the following correct output:
ct_off_time mydata2
-- --
05-MAY-03 18:57:57.7 1.97044
24-JAN-03 11:46:07.8 8
16-AUG-03 09:58:27.9 5.30701
.......
16-AUG-03 21:22:57.7 6.09582
10-DEC-02 16:46:37.6 8
AVG 5.25773
If I could change the above code where I could store the "calculate avg as
mydata3" I could then put the data into excel.
But I can't do this
How can I store the AVG 5.25773 into a variable so I can use it in Excel
like so:
ADO_rs.Open
ActiveCell.Offset(x, 5).Value = ADO_rs.Fields!AVG GOES HERE
Maybe there is an easier way to do this? Any suggestions?
David
Hi
This seems to be very Excel specific SQL and therefore not really covered by
SQL server!
At a guess you will need to move the Average function into the select
columns
John
"Aster99" <Aster99@.home.net> wrote in message
news:%23igwDlOKEHA.204@.TK2MSFTNGP10.phx.gbl...
> I'm using VB to write some data to an Excel spreadsheet.
> I use the following vb/sql statement to get the data I need:
> ADO_rs.Source = "select least(2+(0.044117*CT_OFF_GEN),8)/count(*)as
mydata2
> calculate avg from """ + "6b_NRatio" + """.1 where ct_text like 'on/off
> it produces the following correct output:
> ct_off_time mydata2
> -- --
> 05-MAY-03 18:57:57.7 1.97044
> 24-JAN-03 11:46:07.8 8
> 16-AUG-03 09:58:27.9 5.30701
> ......
> 16-AUG-03 21:22:57.7 6.09582
> 10-DEC-02 16:46:37.6 8
> --
> AVG 5.25773
> If I could change the above code where I could store the "calculate avg as
> mydata3" I could then put the data into excel.
> But I can't do this
> How can I store the AVG 5.25773 into a variable so I can use it in Excel
> like so:
> ADO_rs.Open
> ActiveCell.Offset(x, 5).Value = ADO_rs.Fields!AVG GOES HERE
> Maybe there is an easier way to do this? Any suggestions?
> David
>

Put record in database.

Hello,
I have a database where each record has the following fields:
[id], [datetime], [name], [price]
I have an array with 1000 records which I need to save in the array.
When placing an array record, in the database, I need to check if there
is already one with the same datetime. If there is I want to replace the
name and price of that record. If there isn't I want to create a new
record.
Is this possible?
Thanks,
MiguelShapper,
I think you mean table?
I once wrote a simple DTS package to do what you're asking that replaced a
complex 8 page stored procedure using cursors. Took the op time from 20
hours to < 1 hour. I'd look at DTS for your UPDATE/INSERT.
HTH
Jerry
"Shapper" <mdmoura*NOSPAM*@.gmail.*DELETE2SEND*com> wrote in message
news:uVmnle00FHA.1032@.TK2MSFTNGP12.phx.gbl...
> Hello,
> I have a database where each record has the following fields:
> [id], [datetime], [name], [price]
> I have an array with 1000 records which I need to save in the array.
> When placing an array record, in the database, I need to check if there is
> already one with the same datetime. If there is I want to replace the name
> and price of that record. If there isn't I want to create a new record.
> Is this possible?
> Thanks,
> Miguel
>|||You will need to use an IF Exist condition. But what do you want to change
the name and price to?
"Shapper" wrote:

> Hello,
> I have a database where each record has the following fields:
> [id], [datetime], [name], [price]
> I have an array with 1000 records which I need to save in the array.
> When placing an array record, in the database, I need to check if there
> is already one with the same datetime. If there is I want to replace the
> name and price of that record. If there isn't I want to create a new
> record.
> Is this possible?
> Thanks,
> Miguel
>

Monday, March 26, 2012

Push works / Pull doesn't

When I set up a pull subscription through the wizard, I get the following error when I try to run the distribution agent:
-->
The subscription to publication '(null)' has expired and does not exist. The step failed.
<--
If I set up a push subscription, everything works fine. Any ideas what would cause this issue?
Thanks in advance!
Greg,
there was an issue with this in SQL 7.0:
http://www.kbalertz.com/Feedback_290054.aspx.
Hopefully this is relevant to your case (;-))
Regards,
Paul
|||Here's more info:
I'm using sql server 2000, sp3 on win2kadv server on both publisher and subscriber. It's a Transaction replication publication, no merge or updating back to the publisher. I set up a very simple database with one table that has a primary key and a varchar
(50) column, and 3 rows to isolate the problem. The snapshot runs quick, but the pull distribution agent keeps getting the before mentioned error. If I set up a push subscription, it works.
Any ideas?
|||Greg,
as far as I can tell, this error is raised from
sp_MShelp_distribution_agentid, which is undocumented. The error message
relates to the independant_agent setting when you created the publication.
Please could you run profiler on the subscriber while you try the pull
subscription to check if this is the case. If so please post up the
arguments sent to the procedure and your script which creates the
publication and I'll see if I can get any further.
Regards,
Paul Ibison
|||I figured it out! I set up aliases rather than using ip addresses and it is now working.
http://support.microsoft.com/?id=321822

Push subscription failing

SQL Server Enterprise Manager encountered errors creating push subscriptions
for the following Subscribers:
JANUS: Error 208: Invalid object name 'sysextendedarticlesview'.
The error above shows up each time that I attempt to push the subscription.
THe view sysextendedarticlesview exist in the publisher database. DOes
anybody know how to fix this thing? THanks
issue this on the subscriber in the subscription database.
create view dbo.sysextendedarticlesview
as
select * from sysarticles
union all
select artid, NULL, creation_script, NULL, description,
dest_object, NULL, NULL, NULL, name, objid, pubid,
pre_creation_cmd, status, NULL, type, NULL,
schema_option, dest_owner from sysschemaarticles
go
Hilary Cotter
Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602.html
"Pete Ocasio" <pete.ocasio@.execupay.com> wrote in message
news:OKRoJYKsEHA.2788@.TK2MSFTNGP09.phx.gbl...
> SQL Server Enterprise Manager encountered errors creating push
subscriptions
> for the following Subscribers:
> JANUS: Error 208: Invalid object name 'sysextendedarticlesview'.
> The error above shows up each time that I attempt to push the
subscription.
> THe view sysextendedarticlesview exist in the publisher database. DOes
> anybody know how to fix this thing? THanks
>
sql

Push referenced records

Hi,
I am facing the following problem. Please help me to solve it.
My question is: How to force the replication engine to include not only
the updated records but the relevant records as well?
I am using merge replication (SQL2kSP3 with SQL2kCE) with row filtering.
I many cases i have to replicate tables with "many to many"
relationship, where i operate the connection table (BOOKPERSON in the
example bellow). All the rows are filtered by PERSON_ID through out the
database.
Eg.
PERSON records to send:
select * from person where person_id = HOST_NAME()
BOOK records to send:
select * from book inner join bookperson on book.book_id =
bookperson.book_id and bookperson.person_id = HOST_NAME()
BOOKPERSON records to send:
select * from bookperson where person_id = HOST_NAME()
My problem is the following. The newly initialized subsciption
replicates fine, but in case of inserting 1 row to the table BOOKPERSON
(which means associating a book with a person) causes the replication to
fail, because the it replicates only the inserted BOOKPERSON record, and
does not replicate the the relevant BOOK record that is referenced now
by the BOOKPERSON record.
So my question is: How to force the replication engine to include not
only the updated records but the relevant records as well?
Thanks in advance
Pierre
The relevant schema is as follows:
CREATE TABLE Book (
BOOK_ID int not null,
BOOK_TITLE varchar(30) not null,
constraint PK_BOOK primary key clustered (BOOK_ID)
)
CREATE TABLE Person (
PERSON_ID int not null,
PERSON_NAME varchar(30) not null,
constraint PK_PERSON primary key clustered (PERSON_ID)
)
CREATE TABLE BookPerson (
BOOK_ID int not null,
PERSON_ID int not null,
constraint PK_BOOKPERSON primary key clustered (BOOK_ID, PERSON_ID)
)
ALTER TABLE BookPerson
ADD CONSTRAINT FK_BOOKPERSON foreign key (BOOK_ID)
references BOOK (BOOK_ID)
ALTER TABLE BookPerson
ADD CONSTRAINT FK_PERSONBOOK foreign key (PERSON_ID)
references PERSON (PERSON_ID)
Pierre,
presumably the personid value for a bookperson and book are not really
referring to the same entity (a person can be related to an individual book
as eg an author and as a reader), otherwise the related book would already
be replicated? In that case I'd say that the filter clause on the Books
article is incorrect. The simplest way would be to drop this filter and
replicate all the books.
HTH,
Paul Ibison
(recommended sql server 2000 replication book:
http://www.nwsu.com/0974973602p.html)
|||Paul,
I think I forgot to tell that we have thousands of records in the "BOOK"
table, and our subscribers have very limited storage capacity (~1000
thousand book records).
The relation between the two tables (person, book) is not like "authors
of a book" but "books 'thouched' by person", so there is a real M:N
relationship.
Meanwhile found the solution to my problem. I think I have to create
triggers (for insert, delete and update) on the table BookPerson which
will use a stored procedure (sp_mergedummyupdate) to force the
replication engine to put the relevant book records into the publication.
Am I right?
regards
Pierre
|||Pierre,
this sounds correct. Actually I misread your original post and didn't notice
the inner join, so was thinking that the PersonID was a FK directly to the
books table as an author. You'll need to make sure that the FK relationship
is 'Not For Replication', as you can't guarantee the replication order (in
SQL 2005 the default is PK then FK records but not in SQL 2000).
Regards,
Paul Ibison
|||Thank you for the tip, i`ll try it.
pierre
|||Paul,
we have tried to script the references with the "NOT FOR REPLICATION" option
and it caused SQL Server CE to completly break down at replication. After a
quick search on MSDN we found a reported bug saying that SQL Server CE
doesn't support the option mentioned above. (to be specfic SQL Server CE
supports NOT FOR REPLICATION, but there is a bug so we can't use it.)
If I'm not mistaken we have to drop all our references in these
circustances. Am I right? Is there any way to control the order of bulk
inserts at replication. (after PDA downloaded the appropriate snapshot, it
starts to bulk insert & update the rows)
regards
Pierre
"Paul Ibison" wrote:

> Pierre,
> this sounds correct. Actually I misread your original post and didn't notice
> the inner join, so was thinking that the PersonID was a FK directly to the
> books table as an author. You'll need to make sure that the FK relationship
> is 'Not For Replication', as you can't guarantee the replication order (in
> SQL 2005 the default is PK then FK records but not in SQL 2000).
> Regards,
> Paul Ibison
>
>
|||Pierre,
can you post up your reference for this CE bug (I'll put it on my website).
I haven't seen this reference, but if that is the case, you could increase
the -UploadGenerationsPerBatch
and the -DownloadGenerationsPerBatch parameters (to the max of 2000) to
avoid splitting parent and child changes across generation batches.
See http://support.microsoft.com/default...b;EN-US;308266 for more
info.
HTH,
Paul Ibison
(recommended sql server 2000 replication book:
http://www.nwsu.com/0974973602p.html)
|||BUG: NOT FOR REPLICATION Clause Causes SQL Server CE Replication to Fail
http://support.microsoft.com/default...b;en-us;300597
...however SQL Server CE Books Online says that "NOT FOR REPLICATION" is not
supported in case of foreign key constriants...
anyway, thanks for the tip, i'll try that.
pierre
sql

Friday, March 23, 2012

purpose of writing dates in this format

hi Experts,
what is the purpose writing a date in the following format:

where x.event_date >= {ts '1980-01-01 00:00:00'}
versus like this:
where x.event_date >= '1980-01-01 00:00:00'

what benifit does it add to later form of writing?
Thanks in advance.
schal.On 15.01.2007 16:34, schal wrote:

Quote:

Originally Posted by

hi Experts,
what is the purpose writing a date in the following format:
>
where x.event_date >= {ts '1980-01-01 00:00:00'}
versus like this:
where x.event_date >= '1980-01-01 00:00:00'
>
what benifit does it add to later form of writing?


It's JDBC / ODBC escape syntax for timestamps.

http://java.sun.com/j2se/1.4.2/docs...ent.html#999472
http://support.microsoft.com/?scid=...142930&x=9&y=15
The former is converted by the ODBC / JDBC driver to some DB specific
binary representation of a timestamp while the latter undergoes
conversion in the DB. I'd generally use the escape syntax as it is more
portable and not affected by session parameters that affect date formatting.

Kind regards

robert|||schal (shivaramchalla@.gmail.com) writes:

Quote:

Originally Posted by

where x.event_date >= {ts '1980-01-01 00:00:00'}
versus like this:
where x.event_date >= '1980-01-01 00:00:00'
>
what benifit does it add to later form of writing?


In addition to Robert's post, Tibor Karaszi's article on date format gives
some more information:
http://www.karaszi.com/SQLServer/info_datetime.asp.

--
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se
Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pr...oads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodin...ions/books.mspx|||robert
Thank you very much for clearing that
Erland
thanks for refering me to the article
the tips are very imformative and helpful
__

Erland Sommarskog wrote:

Quote:

Originally Posted by

schal (shivaramchalla@.gmail.com) writes:

Quote:

Originally Posted by

where x.event_date >= {ts '1980-01-01 00:00:00'}
versus like this:
where x.event_date >= '1980-01-01 00:00:00'

what benifit does it add to later form of writing?


>
In addition to Robert's post, Tibor Karaszi's article on date format gives
some more information:
http://www.karaszi.com/SQLServer/info_datetime.asp.
>
>
--
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se
>
Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pr...oads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodin...ions/books.mspx

|||Robert,
Thank you very much for clearing that
Erland,
thanks for refering me to the article
the tips are very imformative and helpful
__

Erland Sommarskog wrote:

Quote:

Originally Posted by

schal (shivaramchalla@.gmail.com) writes:

Quote:

Originally Posted by

where x.event_date >= {ts '1980-01-01 00:00:00'}
versus like this:
where x.event_date >= '1980-01-01 00:00:00'

what benifit does it add to later form of writing?


>
In addition to Robert's post, Tibor Karaszi's article on date format gives
some more information:
http://www.karaszi.com/SQLServer/info_datetime.asp.
>
>
--
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se
>
Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pr...oads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodin...ions/books.mspx

sql

Wednesday, March 21, 2012

purge all history from msdb

I am looking for a way to setup a periodic delete from all history tables in
msdb, to prevent excessive growth. I am wondering if the following procedures
includes all necessary deletes.
1) In the maintenance plan wizard reporting tab, setting the number of
records to retain in sys_dbmaintplanhistory; older records will be deleted.
2) Run sp_delete_backuphistory to delete records from several backup and
restore history tables.
3) Run sp_purge_jobhistory to remove history from other jobs.
Am I missing anything? There is also an sp_purgehistory, but BOL says this
is for backward compatibility only; does anyone use this?
--
MunchingBillHi Munching,
Thanks for your post.
It is not necessary for you to execute sp_purgehistory. Based on my
knowledge, these three steps you have listed are sufficient for you to
delete from all history tables.
Also, please note that this question appears to be consulting in nature. We
would also like to introduce you to the CSS Advisory Services team.
Advisory Services is a remotely delivered, hourly fee-based, consultative
support option that provides a comprehensive result beyond your break-fix
product maintenance needs. It is an hourly fee-based, consultative
support option that provides proactive support beyond your break-fix
product maintenance needs. This support option includes working with the
same technician for assistance with issues like product migration, code
review, or new program development.
For more info in the US and Canada:
http://support.microsoft.com/default.aspx?pr=AdvisoryService
Outside of the US/Canada:
http://support.microsoft.com/default.aspx?scid=%2finternational.aspx
Sincerely yours,
Michael Cheng
Microsoft Online Partner Support
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
=====================================================Business-Critical Phone Support (BCPS) provides you with technical phone
support at no charge during critical LAN outages or "business down"
situations. This benefit is available 24 hours a day, 7 days a week to all
Microsoft technology partners in the United States and Canada.
This and other support options are available here:
BCPS:
https://partner.microsoft.com/US/technicalsupport/supportoverview/40010469
Others: https://partner.microsoft.com/US/technicalsupport/supportoverview/
If you are outside the United States, please visit our International
Support page: http://support.microsoft.com/common/international.aspx
=====================================================This posting is provided "AS IS" with no warranties, and confers no rights.

purge all history from msdb

I am looking for a way to setup a periodic delete from all history tables in
msdb, to prevent excessive growth. I am wondering if the following procedure
s
includes all necessary deletes.
1) In the maintenance plan wizard reporting tab, setting the number of
records to retain in sys_dbmaintplanhistory; older records will be deleted.
2) Run sp_delete_backuphistory to delete records from several backup and
restore history tables.
3) Run sp_purge_jobhistory to remove history from other jobs.
Am I missing anything? There is also an sp_purgehistory, but BOL says this
is for backward compatibility only; does anyone use this?
--
MunchingBillHi Munching,
Thanks for your post.
It is not necessary for you to execute sp_purgehistory. Based on my
knowledge, these three steps you have listed are sufficient for you to
delete from all history tables.
Also, please note that this question appears to be consulting in nature. We
would also like to introduce you to the CSS Advisory Services team.
Advisory Services is a remotely delivered, hourly fee-based, consultative
support option that provides a comprehensive result beyond your break-fix
product maintenance needs. It is an hourly fee-based, consultative
support option that provides proactive support beyond your break-fix
product maintenance needs. This support option includes working with the
same technician for assistance with issues like product migration, code
review, or new program development.
For more info in the US and Canada:
http://support.microsoft.com/defaul...AdvisoryService
Outside of the US/Canada:
http://support.microsoft.com/defaul...ernational.aspx
Sincerely yours,
Michael Cheng
Microsoft Online Partner Support
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
========================================
=============
Business-Critical Phone Support (BCPS) provides you with technical phone
support at no charge during critical LAN outages or "business down"
situations. This benefit is available 24 hours a day, 7 days a week to all
Microsoft technology partners in the United States and Canada.
This and other support options are available here:
BCPS:
https://partner.microsoft.com/US/te...erview/40010469
Others: https://partner.microsoft.com/US/te...upportoverview/
If you are outside the United States, please visit our International
Support page: http://support.microsoft.com/common/international.aspx
========================================
=============
This posting is provided "AS IS" with no warranties, and confers no rights.

purge all history from msdb

I am looking for a way to setup a periodic delete from all history tables in
msdb, to prevent excessive growth. I am wondering if the following procedures
includes all necessary deletes.
1) In the maintenance plan wizard reporting tab, setting the number of
records to retain in sys_dbmaintplanhistory; older records will be deleted.
2) Run sp_delete_backuphistory to delete records from several backup and
restore history tables.
3) Run sp_purge_jobhistory to remove history from other jobs.
Am I missing anything? There is also an sp_purgehistory, but BOL says this
is for backward compatibility only; does anyone use this?
MunchingBill
Hi Munching,
Thanks for your post.
It is not necessary for you to execute sp_purgehistory. Based on my
knowledge, these three steps you have listed are sufficient for you to
delete from all history tables.
Also, please note that this question appears to be consulting in nature. We
would also like to introduce you to the CSS Advisory Services team.
Advisory Services is a remotely delivered, hourly fee-based, consultative
support option that provides a comprehensive result beyond your break-fix
product maintenance needs. It is an hourly fee-based, consultative
support option that provides proactive support beyond your break-fix
product maintenance needs. This support option includes working with the
same technician for assistance with issues like product migration, code
review, or new program development.
For more info in the US and Canada:
http://support.microsoft.com/default...dvisoryService
Outside of the US/Canada:
http://support.microsoft.com/default...rnational.aspx
Sincerely yours,
Michael Cheng
Microsoft Online Partner Support
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
================================================== ===
Business-Critical Phone Support (BCPS) provides you with technical phone
support at no charge during critical LAN outages or "business down"
situations. This benefit is available 24 hours a day, 7 days a week to all
Microsoft technology partners in the United States and Canada.
This and other support options are available here:
BCPS:
https://partner.microsoft.com/US/tec...rview/40010469
Others: https://partner.microsoft.com/US/tec...pportoverview/
If you are outside the United States, please visit our International
Support page: http://support.microsoft.com/common/international.aspx
================================================== ===
This posting is provided "AS IS" with no warranties, and confers no rights.

purchase order query: very funny and challenge ^_^

i query a purchase order table, there is one column called PO_No, format: LP-0245111-0004

i make following statement to query: the middle code act as my id, using it search my records, the last 4 digit used to find the last purchase order number

SqlSelectCommand2.CommandText = "SELECT PO_No FROM [PURCHASE ORDER] WHERE PO_No Like '%" & GetYearCode() & "%' ORDER BY Right(PO_No, 4) DESC"

i checked my database, last record is LP-0545381-0300

in my debuging process, surprisingly found that selected record is LP-0545381-301 !

any one hav any suggestion? ^_^

I fail to see the humor here, but that's irrelevant. It's difficult to know the query behavior without knowing what GetYearCode() is supposed to return and how it relates to the data in your table. Also, why does your last record (LP-0545381-301) have only 3 digits at the end when your format suggests that it should contain 4 digits? Finally, what were you expecting the result to be?|||

database never had that record, but selected out, isnt it very funny...anyway, GetYearCode() will return the middle code as0545381, i also suprisingly why return 3 digit?!unreasonable, isnt it

what i expected result isLP-0545381-0300

Tuesday, March 20, 2012

Pulling out table and column descriptions

When I run the following query:
Select * From Information_Schema.columns Where TABLE_NAME = 'Answers'
I see that, for my table "Answers", I have 9 rows returned, showing each
field in my table.
The sysobjects query shows where I can get the Id for Answers and use it for
getting the field descriptions from sysproperties (along with a table
description):
Select * From sysobjects Where name = 'Answers'
Select * From sysproperties Where id = 859150106
The trouble I am having is I want to join the the column and sysproperties
tables together, but I get back 38 rows showing a lot of duplicate data when
I only want the 9 rows that define my Answers table. Can someone show and
explain to me what I am doing wrong? Below is the query I tried that returne
d
38 rows instead of the 9 I wanted. Thank you.
Select isc.table_name, isc.column_name, sp.value
From sysproperties sp
Join Information_Schema.columns isc On sp.smallid = isc.ordinal_position
Where isc.table_name = 'Answers'Hello, Mike
Try something like this:
SELECT c.name as ColumnName, p.value as Description
FROM syscolumns c
INNER JOIN sysobjects o ON c.id=o.id
LEFT JOIN sysproperties p
ON p.smallid=c.colid AND p.id=o.id AND p.name='MS_Description'
WHERE o.name='YourTable' ORDER BY c.colid
Razvan|||Exactly what I wanted. Thanks.
"Razvan Socol" wrote:

> Hello, Mike
> Try something like this:
> SELECT c.name as ColumnName, p.value as Description
> FROM syscolumns c
> INNER JOIN sysobjects o ON c.id=o.id
> LEFT JOIN sysproperties p
> ON p.smallid=c.colid AND p.id=o.id AND p.name='MS_Description'
> WHERE o.name='YourTable' ORDER BY c.colid
> Razvan
>

Pulling data from 2 tables, 1 with possibly multiple records

I'm trying to create a view which pulls data from the following 2 tables:
CREATE TABLE PC (
PCName varchar(50) NOT NULL,
Make varchar(50),
Model varchar(50),
SerialNumber varchar(50)
PRIMARY KEY
(PCName)
)
INSERT INTO PC(PCName, Make, Model, SerialNumber) values ('TEST1', 'Dell',
'OptiPlex GX1', '12345')
INSERT INTO PC(PCName, Make, Model, SerialNumber) values ('TEST2', 'Dell',
'PowerEdge 6450', '23456')
CREATE TABLE CPU (
PCName varchar(50) NOT NULL REFERENCES PC(PCName),
Row int NOT NULL,
Type varchar(50),
Speed int
PRIMARY KEY
(PCName, Row)
)
INSERT INTO CPU (PCName, Row, Type, Speed) values ('TEST1', 1, 'Pentium
III', 1000)
INSERT INTO CPU (PCName, Row, Type, Speed) values ('TEST2', 1, 'Pentium III
Xeon', 700)
INSERT INTO CPU (PCName, Row, Type, Speed) values ('TEST2', 2, 'Pentium III
Xeon', 700)
INSERT INTO CPU (PCName, Row, Type, Speed) values ('TEST2', 3, 'Pentium III
Xeon', 700)
INSERT INTO CPU (PCName, Row, Type, Speed) values ('TEST2', 4, 'Pentium III
Xeon', 700)
The CPU table holds an entry for each CPU in the PC. Now I want the view to
retrieve 1 row per PC and look like this...
PCName Make Model SerialNumber Type
Speed NumberOfCPUs
========================================
==============================
TEST1 Dell OptiPlex GX1 12345 Pentium III
1000 1
TEST2 Dell PowerEdge 6450 23456 Pentium III
Xeon 1200 4
... where NumberOfCPUs is the max(Row) for each particular PC.
Any ideas? Unfortunately we are stuck with the table structure as is (from
a 3rd party).
ThanksJim
Thanks for posting DDL
See , if this helps you
SELECT PC.PCName,Make,Model,SerialNumber,
Type, Speed,NumberOfCPUs FROM PC JOIN
(
SELECT MAX(Row)NumberOfCPUs,PCName,Type,Speed FROM CPU
GROUP BY PCName,Type,Speed
) AS Der ON PC.PCName=Der.PCName
"Jim Coyne" <REcoyneMO_jimVE@.hoMEtmail.com> wrote in message
news:usUSwQlvFHA.2072@.TK2MSFTNGP14.phx.gbl...
> I'm trying to create a view which pulls data from the following 2 tables:
> CREATE TABLE PC (
> PCName varchar(50) NOT NULL,
> Make varchar(50),
> Model varchar(50),
> SerialNumber varchar(50)
> PRIMARY KEY
> (PCName)
> )
> INSERT INTO PC(PCName, Make, Model, SerialNumber) values ('TEST1', 'Dell',
> 'OptiPlex GX1', '12345')
> INSERT INTO PC(PCName, Make, Model, SerialNumber) values ('TEST2', 'Dell',
> 'PowerEdge 6450', '23456')
> CREATE TABLE CPU (
> PCName varchar(50) NOT NULL REFERENCES PC(PCName),
> Row int NOT NULL,
> Type varchar(50),
> Speed int
> PRIMARY KEY
> (PCName, Row)
> )
> INSERT INTO CPU (PCName, Row, Type, Speed) values ('TEST1', 1, 'Pentium
> III', 1000)
> INSERT INTO CPU (PCName, Row, Type, Speed) values ('TEST2', 1, 'Pentium
> III Xeon', 700)
> INSERT INTO CPU (PCName, Row, Type, Speed) values ('TEST2', 2, 'Pentium
> III Xeon', 700)
> INSERT INTO CPU (PCName, Row, Type, Speed) values ('TEST2', 3, 'Pentium
> III Xeon', 700)
> INSERT INTO CPU (PCName, Row, Type, Speed) values ('TEST2', 4, 'Pentium
> III Xeon', 700)
>
> The CPU table holds an entry for each CPU in the PC. Now I want the view
> to retrieve 1 row per PC and look like this...
> PCName Make Model SerialNumber Type Speed
> NumberOfCPUs
> ========================================
==============================
> TEST1 Dell OptiPlex GX1 12345 Pentium
> III 1000 1
> TEST2 Dell PowerEdge 6450 23456 Pentium III
> Xeon 1200 4
>
> ... where NumberOfCPUs is the max(Row) for each particular PC.
> Any ideas? Unfortunately we are stuck with the table structure as is
> (from a 3rd party).
> Thanks
>|||Yes, that certainly does. Thank you very much.
"Uri Dimant" <urid@.iscar.co.il> wrote in message
news:uMIH0gmvFHA.2312@.TK2MSFTNGP14.phx.gbl...
> Jim
> Thanks for posting DDL
> See , if this helps you
>
> SELECT PC.PCName,Make,Model,SerialNumber,
> Type, Speed,NumberOfCPUs FROM PC JOIN
> (
> SELECT MAX(Row)NumberOfCPUs,PCName,Type,Speed FROM CPU
> GROUP BY PCName,Type,Speed
> ) AS Der ON PC.PCName=Der.PCName
>
> "Jim Coyne" <REcoyneMO_jimVE@.hoMEtmail.com> wrote in message
> news:usUSwQlvFHA.2072@.TK2MSFTNGP14.phx.gbl...
>

Friday, March 9, 2012

Pull an Image from a Database onto a Report Problems

Does anyone know if the following is possible? If so, any pointers on how
to accomplish it?
I have a table in SQL 2000 containing two fields "StoredDoc" and
"StoredDocExtension".
The StoredDoc field is a ntext field. the StoredDocExtension is a char
field.
When uploading an image to the database, the image is stored directly in the
StoredDoc field. The file extension for the file is stored in the
StoredDocExtension field.
I want to create a report that will display the image stored in the
StoredDoc field directly on the report at runtime. If possible, I would
also like the MIME/Type property to be set based on the StoredDocExtension
field.
I have been trying to get this to work tonight and all I get is a red x
where the image should be.
Any suggestions?
Thanks,
JWYou can set the MIME/Type property based on a database field using the
Properties tab of the image. I am not sure if thats what is you are
looking for.
Ravi|||I was able to do that, but I am running into problems converting the image,
which is stored as a ntext value in the database to the actual picture, when
the report is run.
I wasn't sure if Reporting services was able to handle that or if you needed
to do something special to get the image to show up.
Thanks for the help.
JW
"Ravi R" <bofobofo@.yahoo.com> wrote in message
news:1110480130.355102.180250@.o13g2000cwo.googlegroups.com...
> You can set the MIME/Type property based on a database field using the
> Properties tab of the image. I am not sure if thats what is you are
> looking for.
> Ravi
>|||Database images have to be byte arrays in Base 64 encoding.
You may want to try this image.Value expression (assuming your images are
not encoded as Ole-Images which is typical for Access databases):
=System.Convert.FromBase64String(Fields!ImageNTextColumn.Value)
-- Robert
This posting is provided "AS IS" with no warranties, and confers no rights.
"Jeremy Wright" <jwright@.twostep.com> wrote in message
news:uXGxuMaJFHA.580@.TK2MSFTNGP15.phx.gbl...
>I was able to do that, but I am running into problems converting the image,
> which is stored as a ntext value in the database to the actual picture,
> when
> the report is run.
> I wasn't sure if Reporting services was able to handle that or if you
> needed
> to do something special to get the image to show up.
> Thanks for the help.
> JW
> "Ravi R" <bofobofo@.yahoo.com> wrote in message
> news:1110480130.355102.180250@.o13g2000cwo.googlegroups.com...
>> You can set the MIME/Type property based on a database field using the
>> Properties tab of the image. I am not sure if thats what is you are
>> looking for.
>> Ravi
>

publishing report with reference on custom assembly

Hi,
I have a report with reference on ReportLibrary assembly.
In the Code section of the report there is the following code:
Public m_myClass As ReportLibrary.DatabaseInteraction
Protected Overrides Sub OnInit()
m_myClass = ReportLibrary.DatabaseInteraction.GetInstance()
End Sub
When I try to publish this report via Reporting Services API:
warnings = RS.CreateReport(reportName, reportPath, true, definition, null);
I get the following error:
+System.SystemException {"There is an error on line 0 of custom code:
[BC30002] Type 'ReportLibrary.DatabaseInteraction' is not defined. --> There
is an error on line 0 of custom code: [BC30002] Type
'ReportLibrary.DatabaseInteraction' is not defined."}
How I can solve this problem?
Any help would be appreciated.some addition:
my report was deployed from VS before and worked successfully.
this error is happened when I made some changes in the report and tried to
re-publish it.
"Paul Zorin" wrote:
> Hi,
> I have a report with reference on ReportLibrary assembly.
> In the Code section of the report there is the following code:
> Public m_myClass As ReportLibrary.DatabaseInteraction
> Protected Overrides Sub OnInit()
> m_myClass = ReportLibrary.DatabaseInteraction.GetInstance()
> End Sub
> When I try to publish this report via Reporting Services API:
> warnings = RS.CreateReport(reportName, reportPath, true, definition, null);
> I get the following error:
> +System.SystemException {"There is an error on line 0 of custom code:
> [BC30002] Type 'ReportLibrary.DatabaseInteraction' is not defined. --> There
> is an error on line 0 of custom code: [BC30002] Type
> 'ReportLibrary.DatabaseInteraction' is not defined."}
> How I can solve this problem?
> Any help would be appreciated.

Publishing problem ...

Hello,
I have a problem when trying to publish articles for merge
replication. During execution of the snapshot agent I
receive the following error "The process could not bulk
copy out of table '[dbo].[table_name]'. Can anyone help
me with this problem?
Any help at all would be greatly appreciated!
Thanks in advance
Jim S.
Basically it means the snapshot agent locked up, timed out, was blocked, or
somehow deadlocked. What you do is stop and restart the snapshot agent. If
you are dealing with a large table, you may need to manually transfer it to
the subscriber. There are cases where the size of the table becomes nearly
impossible to get a snapshot to complete.
Mike
Principal Mentor
Solid Quality Learning
"More than just Training"
SQL Server MVP
http://www.solidqualitylearning.com
http://www.mssqlserver.com
|||Do I:
1. Just let the snapshot agent run until it fails
during the bcp process
2. Transfer all tables to the subscriber via dts
3. Create subscription using the 'do not create schema
and data option'

>--Original Message--
>Basically it means the snapshot agent locked up, timed
out, was blocked, or
>somehow deadlocked. What you do is stop and restart the
snapshot agent. If
>you are dealing with a large table, you may need to
manually transfer it to
>the subscriber. There are cases where the size of the
table becomes nearly
>impossible to get a snapshot to complete.
>--
>Mike
>Principal Mentor
>Solid Quality Learning
>"More than just Training"
>SQL Server MVP
>http://www.solidqualitylearning.com
>http://www.mssqlserver.com
>
>.
>
|||If it continues to fail, what I normally do is to separate out the table
that are failing into a separate publication. The ones separated out I use
the "do not create..." option and use DTS to manually transfer everything
over. It's ugly and full of trial and error, but it works. There aren't
any other good options at this point, because a snapshot has to complete in
order for transactions to start flowing. The interesting thing you will
find is that DTS will generally transfer the data in about 1/10 the amount
of time that the snapshot takes.
Mike
Principal Mentor
Solid Quality Learning
"More than just Training"
SQL Server MVP
http://www.solidqualitylearning.com
http://www.mssqlserver.com

Wednesday, March 7, 2012

Publisherand suscriptor

Hello,
my question is the following: is it possible a database server can suscript
to a database "A" like a pull or push suscription and publish the same
database to another machines?. So, the machine is suscriptor and publisher of
the same database.
Are there any possible to do that in MSDE 2000?.
Thanks very much.
I see that arrangement described in BOL but have been unable to find out how to set it up.<br />If anyone has any idea how to set this up for merge replication or where to get the info. It would be a big help.<br />thabks.<br /><br />Thanks.

publisher malfunction

Hi,
Has anyone seen a problem like this:
when trying to add an article to an existing publication (i.e. running
sp_addarticle) I get the following error if I run it from my workstation:
[Microsoft][ODBC SQL Server Driver][DBNETLIB]ConnectionCheckForData
(CheckforData()).
Server: Msg 11, Level 16, State 1, Line 0
General network error. Check your network documentation.
Connection Broken
the error is a bit more descriptive when running from the server console:
Server: Msg 8526, Level 16, State 2, Procedure sp_helpdistributor, Line 79
Cannot go remote while the session is enlisted in a distributed transaction
that has an active savepoint.
Connection Broken
Any input would be appreciated
run a dbcc opentrans and see if there is an open or orphaned transaction.
use dbcc inputbuffer to evaluate whether you can kill it or not. If so, kill
it and try to run the sp_addarticle command again.
Also is this with a remote distributor?
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
"Mor DeRor" <MorDeRor@.discussions.microsoft.com> wrote in message
news:55DBD5B3-15F1-4130-8BB8-F3B2FA7294BC@.microsoft.com...
> Hi,
> Has anyone seen a problem like this:
> when trying to add an article to an existing publication (i.e. running
> sp_addarticle) I get the following error if I run it from my workstation:
> [Microsoft][ODBC SQL Server Driver][DBNETLIB]ConnectionCheckForData
> (CheckforData()).
> Server: Msg 11, Level 16, State 1, Line 0
> General network error. Check your network documentation.
> Connection Broken
> the error is a bit more descriptive when running from the server console:
> Server: Msg 8526, Level 16, State 2, Procedure sp_helpdistributor, Line 79
> Cannot go remote while the session is enlisted in a distributed
> transaction
> that has an active savepoint.
> Connection Broken
> Any input would be appreciated
|||Thanks Hilary, but it does not look like there is an open transaction. here
is the oputput of DBCC OPENTRAN:
Replicated Transaction Information:
Oldest distributed LSN : (2215838:4377:1)
Oldest non-distributed LSN : (0:0:0)
DBCC execution completed. If DBCC printed error messages, contact your
system administrator.
"Hilary Cotter" wrote:

> run a dbcc opentrans and see if there is an open or orphaned transaction.
> use dbcc inputbuffer to evaluate whether you can kill it or not. If so, kill
> it and try to run the sp_addarticle command again.
> Also is this with a remote distributor?
> --
> 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
>
> "Mor DeRor" <MorDeRor@.discussions.microsoft.com> wrote in message
> news:55DBD5B3-15F1-4130-8BB8-F3B2FA7294BC@.microsoft.com...
>
>
|||I found a solution, in case anyone else is interested. It had to do with
"remote proc trans" option being turned on. Here is a link to the forum where
I found it:
http://www.sql-server-performance.com/forum/topic.asp?TOPIC_ID=18530
"Mor DeRor" wrote:
[vbcol=seagreen]
> Thanks Hilary, but it does not look like there is an open transaction. here
> is the oputput of DBCC OPENTRAN:
> Replicated Transaction Information:
> Oldest distributed LSN : (2215838:4377:1)
> Oldest non-distributed LSN : (0:0:0)
> DBCC execution completed. If DBCC printed error messages, contact your
> system administrator.
>
> "Hilary Cotter" wrote:

Saturday, February 25, 2012

Publications with Pending Status

I am receiving the following errors in the event viewer:
Application log
SubSystem Message - Job 'BOS01-253-USICOAL-1'
(0x5E7E64490BAF924BB783E4C4F54C3E19), step 2 - SQL Server Agent could not
access the replication agent. Use the DCOMCNFG utility to confirm that the
SQL Server Agent Windows account has permissions to launch the replication
agent.
system log
Access denied attempting to launch a DCOM Server. The server is:
{08B0B2D9-3FB3-11D3-A4DE-00C04F610189}
The user is SYSTEM/NT AUTHORITY, SID=S-1-5-18.
I am running windows 2003 Server with XP Embedded clients, replication is
configured as push jobs from the distributer.
are you using remote agent activation?
If not, run DCOMCNFG to determine exactly where your merge agent is running.
Hilary Cotter
Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602.html
"Mark" <Mark@.discussions.microsoft.com> wrote in message
news:88C3A06B-CA0A-41D3-9100-4DD33BB79CA5@.microsoft.com...
>I am receiving the following errors in the event viewer:
> Application log
> SubSystem Message - Job 'BOS01-253-USICOAL-1'
> (0x5E7E64490BAF924BB783E4C4F54C3E19), step 2 - SQL Server Agent could not
> access the replication agent. Use the DCOMCNFG utility to confirm that the
> SQL Server Agent Windows account has permissions to launch the replication
> agent.
> system log
> Access denied attempting to launch a DCOM Server. The server is:
> {08B0B2D9-3FB3-11D3-A4DE-00C04F610189}
> The user is SYSTEM/NT AUTHORITY, SID=S-1-5-18.
> I am running windows 2003 Server with XP Embedded clients, replication is
> configured as push jobs from the distributer.
|||I don't thinks so, where do I check?
I have used DCOMCNFG and the merge agent is running locally.
Thanks
Mark
"Hilary Cotter" wrote:

> are you using remote agent activation?
> If not, run DCOMCNFG to determine exactly where your merge agent is running.
> --
> Hilary Cotter
> Looking for a SQL Server replication book?
> http://www.nwsu.com/0974973602.html
> "Mark" <Mark@.discussions.microsoft.com> wrote in message
> news:88C3A06B-CA0A-41D3-9100-4DD33BB79CA5@.microsoft.com...
>
>
|||Not sure if we are using remote agent activation, where do I check?
I have checked in DCOMCNFG and the merge agent is running locally.
thanks
Mark
"Hilary Cotter" wrote:

> are you using remote agent activation?
> If not, run DCOMCNFG to determine exactly where your merge agent is running.
> --
> Hilary Cotter
> Looking for a SQL Server replication book?
> http://www.nwsu.com/0974973602.html
> "Mark" <Mark@.discussions.microsoft.com> wrote in message
> news:88C3A06B-CA0A-41D3-9100-4DD33BB79CA5@.microsoft.com...
>
>
|||script out your publication and post it here.
Hilary Cotter
Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602.html
"Mark" <Mark@.discussions.microsoft.com> wrote in message
news:B3C9C4EA-A8EC-44F1-AFA5-FBF2CB721251@.microsoft.com...[vbcol=seagreen]
> I don't thinks so, where do I check?
> I have used DCOMCNFG and the merge agent is running locally.
> Thanks
> Mark
> "Hilary Cotter" wrote:
running.[vbcol=seagreen]
not[vbcol=seagreen]
the[vbcol=seagreen]
replication[vbcol=seagreen]
is[vbcol=seagreen]
|||Also check the Security tab for Microsoft SQL Server Replication Merge Agent
8.0 Properties, and verify that for the default Launch Permissions, the
everyone group has special access.
Hilary Cotter
Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602.html
"Mark" <Mark@.discussions.microsoft.com> wrote in message
news:7B60532F-1088-4BD9-9061-8BA6A7A044A7@.microsoft.com...[vbcol=seagreen]
> Not sure if we are using remote agent activation, where do I check?
> I have checked in DCOMCNFG and the merge agent is running locally.
> thanks
> Mark
> "Hilary Cotter" wrote:
running.[vbcol=seagreen]
not[vbcol=seagreen]
the[vbcol=seagreen]
replication[vbcol=seagreen]
is[vbcol=seagreen]
|||Here is one of the publications:
-- Enabling the replication database
use master
GO
exec sp_replicationdboption @.dbname = N'USICOAL', @.optname = N'publish',
@.value = N'true'
GO
use [USICOAL]
GO
-- Adding the transactional publication
exec sp_addpublication @.publication = N'PUB_ITEM', @.restricted = N'false',
@.sync_method = N'native', @.repl_freq = N'continuous', @.description =
N'Transactional publication of item data (PLU)', @.status = N'active',
@.allow_push = N'true', @.allow_pull = N'true', @.allow_anonymous = N'false',
@.enabled_for_internet = N'false', @.independent_agent = N'false',
@.immediate_sync = N'false', @.allow_sync_tran = N'false', @.autogen_sync_procs
= N'false', @.retention = 0, @.allow_queued_tran = N'false',
@.snapshot_in_defaultfolder = N'true', @.compress_snapshot = N'false',
@.ftp_port = 21, @.ftp_login = N'anonymous', @.allow_dts = N'false',
@.allow_subscription_copy = N'false', @.add_to_active_directory = N'false',
@.logreader_job_name = N'BOS01-253-USICOAL-1'
exec sp_addpublication_snapshot @.publication = N'PUB_ITEM',@.frequency_type =
4, @.frequency_interval = 1, @.frequency_relative_interval = 1,
@.frequency_recurrence_factor = 0, @.frequency_subday = 8,
@.frequency_subday_interval = 1, @.active_start_date = 0, @.active_end_date = 0,
@.active_start_time_of_day = 0, @.active_end_time_of_day = 235959,
@.snapshot_job_name = N'BOS01-253-USICOAL-PUB_ITEM-3'
GO
exec sp_grant_publication_access @.publication = N'PUB_ITEM', @.login = N'admin'
GO
exec sp_grant_publication_access @.publication = N'PUB_ITEM', @.login =
N'BUILTIN\Administrators'
GO
exec sp_grant_publication_access @.publication = N'PUB_ITEM', @.login =
N'distributor_admin'
GO
exec sp_grant_publication_access @.publication = N'PUB_ITEM', @.login = N'sa'
GO
-- Adding the transactional articles
exec sp_addarticle @.publication = N'PUB_ITEM', @.article =
N'ADDITIONAL_INFO', @.source_owner = N'dbo', @.source_object =
N'ADDITIONAL_INFO', @.destination_table = N'ADDITIONAL_INFO', @.type =
N'logbased', @.creation_script = null, @.description = null, @.pre_creation_cmd
= N'drop', @.schema_option = 0x00000000000000F3, @.status = 16,
@.vertical_partition = N'false', @.ins_cmd = N'CALL sp_MSins_ADDITIONAL_INFO',
@.del_cmd = N'CALL sp_MSdel_ADDITIONAL_INFO', @.upd_cmd = N'MCALL
sp_MSupd_ADDITIONAL_INFO', @.filter = null, @.sync_object = null,
@.auto_identity_range = N'false'
GO
exec sp_addarticle @.publication = N'PUB_ITEM', @.article = N'DEPT_SELL_RULE',
@.source_owner = N'dbo', @.source_object = N'DEPT_SELL_RULE',
@.destination_table = N'DEPT_SELL_RULE', @.type = N'logbased', @.creation_script
= null, @.description = null, @.pre_creation_cmd = N'drop', @.schema_option =
0x00000000000000F3, @.status = 16, @.vertical_partition = N'false', @.ins_cmd =
N'CALL sp_MSins_DEPT_SELL_RULE', @.del_cmd = N'CALL sp_MSdel_DEPT_SELL_RULE',
@.upd_cmd = N'MCALL sp_MSupd_DEPT_SELL_RULE', @.filter = null, @.sync_object =
null, @.auto_identity_range = N'false'
GO
exec sp_addarticle @.publication = N'PUB_ITEM', @.article = N'ITEM_GROUP',
@.source_owner = N'dbo', @.source_object = N'ITEM_GROUP', @.destination_table =
N'ITEM_GROUP', @.type = N'logbased', @.creation_script = null, @.description =
null, @.pre_creation_cmd = N'drop', @.schema_option = 0x00000000000000F3,
@.status = 16, @.vertical_partition = N'false', @.ins_cmd = N'CALL
sp_MSins_ITEM_GROUP', @.del_cmd = N'CALL sp_MSdel_ITEM_GROUP', @.upd_cmd =
N'MCALL sp_MSupd_ITEM_GROUP', @.filter = null, @.sync_object = null,
@.auto_identity_range = N'false'
GO
exec sp_addarticle @.publication = N'PUB_ITEM', @.article =
N'ITEM_GROUP_ITEM', @.source_owner = N'dbo', @.source_object =
N'ITEM_GROUP_ITEM', @.destination_table = N'ITEM_GROUP_ITEM', @.type =
N'logbased', @.creation_script = null, @.description = null, @.pre_creation_cmd
= N'drop', @.schema_option = 0x00000000000000F3, @.status = 16,
@.vertical_partition = N'false', @.ins_cmd = N'CALL sp_MSins_ITEM_GROUP_ITEM',
@.del_cmd = N'CALL sp_MSdel_ITEM_GROUP_ITEM', @.upd_cmd = N'MCALL
sp_MSupd_ITEM_GROUP_ITEM', @.filter = null, @.sync_object = null,
@.auto_identity_range = N'false'
GO
exec sp_addarticle @.publication = N'PUB_ITEM', @.article =
N'ITEM_GRP_ADDL_INFO', @.source_owner = N'dbo', @.source_object =
N'ITEM_GRP_ADDL_INFO', @.destination_table = N'ITEM_GRP_ADDL_INFO', @.type =
N'logbased', @.creation_script = null, @.description = null, @.pre_creation_cmd
= N'drop', @.schema_option = 0x00000000000000F3, @.status = 16,
@.vertical_partition = N'false', @.ins_cmd = N'CALL
sp_MSins_ITEM_GRP_ADDL_INFO', @.del_cmd = N'CALL sp_MSdel_ITEM_GRP_ADDL_INFO',
@.upd_cmd = N'MCALL sp_MSupd_ITEM_GRP_ADDL_INFO', @.filter = null, @.sync_object
= null, @.auto_identity_range = N'false'
GO
exec sp_addarticle @.publication = N'PUB_ITEM', @.article = N'PLU',
@.source_owner = N'dbo', @.source_object = N'PLU', @.destination_table = N'PLU',
@.type = N'logbased', @.creation_script = null, @.description = null,
@.pre_creation_cmd = N'drop', @.schema_option = 0x00000000000000F3, @.status =
16, @.vertical_partition = N'false', @.ins_cmd = N'CALL sp_MSins_PLU', @.del_cmd
= N'CALL sp_MSdel_PLU', @.upd_cmd = N'MCALL sp_MSupd_PLU', @.filter = null,
@.sync_object = null, @.auto_identity_range = N'false'
GO
exec sp_addarticle @.publication = N'PUB_ITEM', @.article = N'PLU_PRICE',
@.source_owner = N'dbo', @.source_object = N'PLU_PRICE', @.destination_table =
N'PLU_PRICE', @.type = N'logbased', @.creation_script = null, @.description =
null, @.pre_creation_cmd = N'drop', @.schema_option = 0x00000000000000F3,
@.status = 16, @.vertical_partition = N'false', @.ins_cmd = N'CALL
sp_MSins_PLU_PRICE', @.del_cmd = N'CALL sp_MSdel_PLU_PRICE', @.upd_cmd =
N'MCALL sp_MSupd_PLU_PRICE', @.filter = null, @.sync_object = null,
@.auto_identity_range = N'false'
GO
exec sp_addarticle @.publication = N'PUB_ITEM', @.article =
N'POS_ID_PLU_CODE', @.source_owner = N'dbo', @.source_object =
N'POS_ID_PLU_CODE', @.destination_table = N'POS_ID_PLU_CODE', @.type =
N'logbased', @.creation_script = null, @.description = null, @.pre_creation_cmd
= N'drop', @.schema_option = 0x00000000000000F3, @.status = 16,
@.vertical_partition = N'false', @.ins_cmd = N'CALL sp_MSins_POS_ID_PLU_CODE',
@.del_cmd = N'CALL sp_MSdel_POS_ID_PLU_CODE', @.upd_cmd = N'MCALL
sp_MSupd_POS_ID_PLU_CODE', @.filter = null, @.sync_object = null,
@.auto_identity_range = N'false'
GO
exec sp_addarticle @.publication = N'PUB_ITEM', @.article =
N'POS_ITEM_ADDL_INFO', @.source_owner = N'dbo', @.source_object =
N'POS_ITEM_ADDL_INFO', @.destination_table = N'POS_ITEM_ADDL_INFO', @.type =
N'logbased', @.creation_script = null, @.description = null, @.pre_creation_cmd
= N'drop', @.schema_option = 0x00000000000000F3, @.status = 16,
@.vertical_partition = N'false', @.ins_cmd = N'CALL
sp_MSins_POS_ITEM_ADDL_INFO', @.del_cmd = N'CALL sp_MSdel_POS_ITEM_ADDL_INFO',
@.upd_cmd = N'MCALL sp_MSupd_POS_ITEM_ADDL_INFO', @.filter = null, @.sync_object
= null, @.auto_identity_range = N'false'
GO
-- Adding the transactional subscription
exec sp_addsubscription @.publication = N'PUB_ITEM', @.article = N'all',
@.subscriber = N'TILL01-253', @.destination_db = N'USICOAL', @.sync_type =
N'automatic', @.update_mode = N'read only', @.offloadagent = 0,
@.dts_package_location = N'distributor'
GO
-- Adding the transactional subscription
exec sp_addsubscription @.publication = N'PUB_ITEM', @.article = N'all',
@.subscriber = N'TILL02-253', @.destination_db = N'USICOAL', @.sync_type =
N'automatic', @.update_mode = N'read only', @.offloadagent = 0,
@.dts_package_location = N'distributor'
GO
-- Adding the transactional subscription
exec sp_addsubscription @.publication = N'PUB_ITEM', @.article = N'all',
@.subscriber = N'TILL03-253', @.destination_db = N'USICOAL', @.sync_type =
N'automatic', @.update_mode = N'read only', @.offloadagent = 0, @.offloadserver
= N'<NULL>', @.dts_package_location = N'distributor'
GO
-- Adding the transactional subscription
exec sp_addsubscription @.publication = N'PUB_ITEM', @.article = N'all',
@.subscriber = N'TILL04-253', @.destination_db = N'USICOAL', @.sync_type =
N'automatic', @.update_mode = N'read only', @.offloadagent = 0, @.offloadserver
= N'TILL04-253', @.dts_package_location = N'distributor'
GO
"Hilary Cotter" wrote:

> script out your publication and post it here.
> --
> Hilary Cotter
> Looking for a SQL Server replication book?
> http://www.nwsu.com/0974973602.html
> "Mark" <Mark@.discussions.microsoft.com> wrote in message
> news:B3C9C4EA-A8EC-44F1-AFA5-FBF2CB721251@.microsoft.com...
> running.
> not
> the
> replication
> is
>
>