Showing posts with label everybody. Show all posts
Showing posts with label everybody. Show all posts

Friday, March 30, 2012

HELP!!! Trying to schedule SSIS package

Hello everybody,

I try to schedule a SSIS package.

When I run manualy, it works without error but when I schedule it, the step fail with error: "Executed as user:... The package execution failed. The step failed."

This package contain just a SQL Task that execute a truncate table (it's for the test...)

I try all solution I found in this forum and others but all not works.

Have you an idea ?

Thanks a lot

Arnaud

Are you doing any logging? The error message will be in there.

You should also take note of this: http://wiki.sqlis.com/default.aspx/SQLISWiki/ScheduledPackages.html

-Jamie

|||

Ok it's working now.

It's just because the connection failed and the path for the flath file must be \\<server>\<directory>\<file>

Thanks very much for your swiftness

Arnaud

sql

Wednesday, March 28, 2012

Help! Unable to restore DB from SQL7 to SQL2000

Hi Good Day everybody,
Currently, I'm planning to upgrade SQL7 to SQL2000, the configuration are
below:
Current Server (Server A)
a) Windows NT4 SP6a
b) SQL 7 + SP4
c) Default Collation: SQL_Latin1_General_CP1_CI_AS
d) Default Data Location: E:\MSSQL7
New Server (Server B)
a) Window 2000 Server SP4
b) SQL 2000 + SP3a
c) Default Collation: Latin1_General_CP1_CI_AS (required to set as default)
d) Default Data Location: D:\Program Files\Microsoft SQL Server
Authentication Mode:
a) Mixed Mode
b) SQL and Windows Authentication
* Both server are login with same userid and password.
Problem:
I have create and new user database "PA_CCCTemp" in the SQL2000 server.
Besides, I also backup user database "PA_CCC" from SQL7.
However, during I restore databases that I have backup into the SQL2000
server, I hit an error "Microsoft SQL-DMo [ODBC SQLState:42000] The backup
set holds a backup of a database other than the existing 'PA_CCCTemp"
database. Restore Databse is terminating abnormally.
I do not know what is the problem caused. Either the database is different
name, or the restoration location are different from the original place, or
the collation is different.
I also need help on how I can migrate the database from SQL7 to SQL 2000,
includes user id and logon password.
Regards,
Polar Bear
Hi,
It seems you have given a physical location which is not in the new server
(Drive and directory) while loading in SQL 2000.
Please follow the below steps in query analyzer:-
Restore filelistonly from disk='c:\backup\dbname.bak'
( replace the 'c:\backup\dbname.bak' with the actual backup file name with
path where the file resides.)
This will give you the Logical and Physical file names of the Backup file
name. While loading you should give the
correct logical file name and the place to keep the physical file. But
Physical file name can be a diffrent one.
Restore Database <dbname> from disk= 'c:\backup\dbname.bak' with
move 'logical_mdf_name' to 'c:\mssql\data\phys_data_name.Xmdf',
move 'logical_ldf_name' to 'c:\mssql\data\phys_log_name.lXdf'
(Replace the logical_mdf_name and logical_ldf_name with the logical name you
got from RESTORE FILELISTONLY command.
Ensure that the directory give in physical file name is there in the server)
Thanks
Hari
SQL Server MVP
Thanks
Hari
SQL Server MVP
"Polar Bear" <Polar Bear@.discussions.microsoft.com> wrote in message
news:227A549B-7D5A-48DA-A4F5-1850CE31B84B@.microsoft.com...
> Hi Good Day everybody,
> Currently, I'm planning to upgrade SQL7 to SQL2000, the configuration are
> below:
> Current Server (Server A)
> a) Windows NT4 SP6a
> b) SQL 7 + SP4
> c) Default Collation: SQL_Latin1_General_CP1_CI_AS
> d) Default Data Location: E:\MSSQL7
> New Server (Server B)
> a) Window 2000 Server SP4
> b) SQL 2000 + SP3a
> c) Default Collation: Latin1_General_CP1_CI_AS (required to set as
> default)
> d) Default Data Location: D:\Program Files\Microsoft SQL Server
> Authentication Mode:
> a) Mixed Mode
> b) SQL and Windows Authentication
> * Both server are login with same userid and password.
> Problem:
> I have create and new user database "PA_CCCTemp" in the SQL2000 server.
> Besides, I also backup user database "PA_CCC" from SQL7.
> However, during I restore databases that I have backup into the SQL2000
> server, I hit an error "Microsoft SQL-DMo [ODBC SQLState:42000] The backup
> set holds a backup of a database other than the existing 'PA_CCCTemp"
> database. Restore Databse is terminating abnormally.
> I do not know what is the problem caused. Either the database is different
> name, or the restoration location are different from the original place,
> or
> the collation is different.
> I also need help on how I can migrate the database from SQL7 to SQL 2000,
> includes user id and logon password.
> Regards,
> Polar Bear
>

Help! Unable to restore DB from SQL7 to SQL2000

Hi Good Day everybody,
Currently, I'm planning to upgrade SQL7 to SQL2000, the configuration are
below:
Current Server (Server A)
a) Windows NT4 SP6a
b) SQL 7 + SP4
c) Default Collation: SQL_Latin1_General_CP1_CI_AS
d) Default Data Location: E:\MSSQL7
New Server (Server B)
a) Window 2000 Server SP4
b) SQL 2000 + SP3a
c) Default Collation: Latin1_General_CP1_CI_AS (required to set as default)
d) Default Data Location: D:\Program Files\Microsoft SQL Server
Authentication Mode:
a) Mixed Mode
b) SQL and Windows Authentication
* Both server are login with same userid and password.
Problem:
I have create and new user database "PA_CCCTemp" in the SQL2000 server.
Besides, I also backup user database "PA_CCC" from SQL7.
However, during I restore databases that I have backup into the SQL2000
server, I hit an error "Microsoft SQL-DMo [ODBC SQLState:42000] The backup
set holds a backup of a database other than the existing 'PA_CCCTemp"
database. Restore Databse is terminating abnormally.
I do not know what is the problem caused. Either the database is different
name, or the restoration location are different from the original place, or
the collation is different.
I also need help on how I can migrate the database from SQL7 to SQL 2000,
includes user id and logon password.
Regards,
Polar BearHi,
It seems you have given a physical location which is not in the new server
(Drive and directory) while loading in SQL 2000.
Please follow the below steps in query analyzer:-
Restore filelistonly from disk='c:\backup\dbname.bak'
( replace the 'c:\backup\dbname.bak' with the actual backup file name with
path where the file resides.)
This will give you the Logical and Physical file names of the Backup file
name. While loading you should give the
correct logical file name and the place to keep the physical file. But
Physical file name can be a diffrent one.
Restore Database <dbname> from disk= 'c:\backup\dbname.bak' with
move 'logical_mdf_name' to 'c:\mssql\data\phys_data_name.­mdf',
move 'logical_ldf_name' to 'c:\mssql\data\phys_log_name.l­df'
(Replace the logical_mdf_name and logical_ldf_name with the logical name you
got from RESTORE FILELISTONLY command.
Ensure that the directory give in physical file name is there in the server)
Thanks
Hari
SQL Server MVP
Thanks
Hari
SQL Server MVP
"Polar Bear" <Polar Bear@.discussions.microsoft.com> wrote in message
news:227A549B-7D5A-48DA-A4F5-1850CE31B84B@.microsoft.com...
> Hi Good Day everybody,
> Currently, I'm planning to upgrade SQL7 to SQL2000, the configuration are
> below:
> Current Server (Server A)
> a) Windows NT4 SP6a
> b) SQL 7 + SP4
> c) Default Collation: SQL_Latin1_General_CP1_CI_AS
> d) Default Data Location: E:\MSSQL7
> New Server (Server B)
> a) Window 2000 Server SP4
> b) SQL 2000 + SP3a
> c) Default Collation: Latin1_General_CP1_CI_AS (required to set as
> default)
> d) Default Data Location: D:\Program Files\Microsoft SQL Server
> Authentication Mode:
> a) Mixed Mode
> b) SQL and Windows Authentication
> * Both server are login with same userid and password.
> Problem:
> I have create and new user database "PA_CCCTemp" in the SQL2000 server.
> Besides, I also backup user database "PA_CCC" from SQL7.
> However, during I restore databases that I have backup into the SQL2000
> server, I hit an error "Microsoft SQL-DMo [ODBC SQLState:42000] The backup
> set holds a backup of a database other than the existing 'PA_CCCTemp"
> database. Restore Databse is terminating abnormally.
> I do not know what is the problem caused. Either the database is different
> name, or the restoration location are different from the original place,
> or
> the collation is different.
> I also need help on how I can migrate the database from SQL7 to SQL 2000,
> includes user id and logon password.
> Regards,
> Polar Bear
>sql

Help! Unable to restore DB from SQL7 to SQL2000

Hi Good Day everybody,
Currently, I'm planning to upgrade SQL7 to SQL2000, the configuration are
below:
Current Server (Server A)
a) Windows NT4 SP6a
b) SQL 7 + SP4
c) Default Collation: SQL_Latin1_General_CP1_CI_AS
d) Default Data Location: E:\MSSQL7
New Server (Server B)
a) Window 2000 Server SP4
b) SQL 2000 + SP3a
c) Default Collation: Latin1_General_CP1_CI_AS (required to set as default)
d) Default Data Location: D:\Program Files\Microsoft SQL Server
Authentication Mode:
a) Mixed Mode
b) SQL and Windows Authentication
* Both server are login with same userid and password.
Problem:
I have create and new user database "PA_CCCTemp" in the SQL2000 server.
Besides, I also backup user database "PA_CCC" from SQL7.
However, during I restore databases that I have backup into the SQL2000
server, I hit an error "Microsoft SQL-DMo [ODBC SQLState:42000] The back
up
set holds a backup of a database other than the existing 'PA_CCCTemp"
database. Restore Databse is terminating abnormally.
I do not know what is the problem caused. Either the database is different
name, or the restoration location are different from the original place, or
the collation is different.
I also need help on how I can migrate the database from SQL7 to SQL 2000,
includes user id and logon password.
Regards,
Polar BearHi,
It seems you have given a physical location which is not in the new server
(Drive and directory) while loading in SQL 2000.
Please follow the below steps in query analyzer:-
Restore filelistonly from disk='c:\backup\dbname.bak'
( replace the 'c:\backup\dbname.bak' with the actual backup file name with
path where the file resides.)
This will give you the Logical and Physical file names of the Backup file
name. While loading you should give the
correct logical file name and the place to keep the physical file. But
Physical file name can be a diffrent one.
Restore Database <dbname> from disk= 'c:\backup\dbname.bak' with
move 'logical_mdf_name' to 'c:\mssql\data\phys_data_name._mdf',
move 'logical_ldf_name' to 'c:\mssql\data\phys_log_name.l_df'
(Replace the logical_mdf_name and logical_ldf_name with the logical name you
got from RESTORE FILELISTONLY command.
Ensure that the directory give in physical file name is there in the server)
Thanks
Hari
SQL Server MVP
Thanks
Hari
SQL Server MVP
"Polar Bear" <Polar Bear@.discussions.microsoft.com> wrote in message
news:227A549B-7D5A-48DA-A4F5-1850CE31B84B@.microsoft.com...
> Hi Good Day everybody,
> Currently, I'm planning to upgrade SQL7 to SQL2000, the configuration are
> below:
> Current Server (Server A)
> a) Windows NT4 SP6a
> b) SQL 7 + SP4
> c) Default Collation: SQL_Latin1_General_CP1_CI_AS
> d) Default Data Location: E:\MSSQL7
> New Server (Server B)
> a) Window 2000 Server SP4
> b) SQL 2000 + SP3a
> c) Default Collation: Latin1_General_CP1_CI_AS (required to set as
> default)
> d) Default Data Location: D:\Program Files\Microsoft SQL Server
> Authentication Mode:
> a) Mixed Mode
> b) SQL and Windows Authentication
> * Both server are login with same userid and password.
> Problem:
> I have create and new user database "PA_CCCTemp" in the SQL2000 server.
> Besides, I also backup user database "PA_CCC" from SQL7.
> However, during I restore databases that I have backup into the SQL2000
> server, I hit an error "Microsoft SQL-DMo [ODBC SQLState:42000] The ba
ckup
> set holds a backup of a database other than the existing 'PA_CCCTemp"
> database. Restore Databse is terminating abnormally.
> I do not know what is the problem caused. Either the database is different
> name, or the restoration location are different from the original place,
> or
> the collation is different.
> I also need help on how I can migrate the database from SQL7 to SQL 2000,
> includes user id and logon password.
> Regards,
> Polar Bear
>

Friday, March 9, 2012

HELP! CDONTS Attachment in SQL server

Hi Everybody,
This is my first post in the forum.
Can someone give me an example how to send an email with an attachment in a SP ?? I have been searching and i haven't found anything useful.

I have been trying several methods and i'm stuck

Right now, I'm using the next SP:

DROP PROCEDURE ST_S_SendMail
GO
CREATE PROCEDURE ST_S_SendMail
(@.FROM NVARCHAR(255),
@.TO NVARCHAR(255),
@.SUBJECT NVARCHAR(255),
@.BODY NVARCHAR(4000))
AS
DECLARE @.Object int
DECLARE @.Hresult int
DECLARE @.ErrorSource varchar (255)
DECLARE @.ErrorDesc varchar (255)
DECLARE @.V_BODY NVARCHAR(4000)

DECLARE @.hr int
DECLARE @.src varchar(255), @.desc varchar(255)

EXEC @.Hresult = sp_OACreate 'CDONTS.NewMail', @.Object OUT

IF @.Hresult = 0 begin
--SET SOME PROPERTIES

SET @.V_BODY = '' + @.BODY
EXEC @.Hresult = sp_OASetProperty @.Object, 'From', @.FROM
EXEC @.Hresult = sp_OASetProperty @.Object, 'To', @.TO
EXEC @.Hresult = sp_OASetProperty @.Object, 'Subject', @.SUBJECT
EXEC @.Hresult = sp_OASetProperty @.Object, 'Body', @.V_BODY

EXEC @.Hresult = sp_OASetProperty @.Object, 'MailFormat', 0

--CALL ATTACHMENT METHOD
EXEC @.Hresult = sp_OAMethod @.Object, 'Attachfile', 'C:\Inetpub\wwwroot\desarrollo\PolizasCP\PolC20031 103.txt', 'poliza.txt', 1

--CALL SEND METHOD
EXEC @.Hresult = sp_OAMethod @.Object, 'Send', NULL

--DESTROY THE OBJECT
EXEC @.Hresult = sp_OADestroy @.Object
end
else
begin
EXEC sp_OAGetErrorInfo @.object, @.src OUT, @.desc OUT
SELECT hr=convert(varbinary(4),@.hr), Source=@.src, Description=@.desc
end

Thanks in advance for your helpHave you tried the following code for sending the attachment mate?

-- Check for multiple attachments separated by a semi-colon ';'.
If @.vcAttachments is not null
Begin
If right(@.vcAttachments,1) <> ';'
Select @.vcAttachments = @.vcAttachments + '; '
Select @.iPos = CharIndex(';', @.vcAttachments, 1)
While @.iPos > 0
Begin
Select @.vcAttachment = ltrim(rtrim(substring(@.vcAttachments, 1, @.iPos -1)))
Select @.vcAttachments = substring(@.vcAttachments, @.iPos + 1, Len(@.vcAttachments)-@.iPos)
EXEC @.iHr = sp_OAMethod @.iMessageObjId, 'AddAttachment', @.iRtn Out, @.vcAttachment
IF @.iHr <> 0
Begin
EXEC sp_OAGetErrorInfo @.iMessageObjId, @.vcErrSource Out, @.vcErrDescription Out
Select @.vcBody = @.vcBody + char(13) + char(10) + char(13) + char(10) +
char(13) + char(10) + 'Error adding attachment: ' +
char(13) + char(10) + @.vcErrSource + char(13) + char(10) +
@.vcAttachment
End
Select @.iPos = CharIndex(';', @.vcAttachments, 1)
End
End

----------

you can find more info about this at www.sqlservercentral.com

Hope this helps...

have a good one|||Originally posted by saulo70
Hi Everybody,
This is my first post in the forum.
Can someone give me an example how to send an email with an attachment in a SP ?? I have been searching and i haven't found anything useful.

I have been trying several methods and i'm stuck

Right now, I'm using the next SP:

DROP PROCEDURE ST_S_SendMail
GO
CREATE PROCEDURE ST_S_SendMail
(@.FROM NVARCHAR(255),
@.TO NVARCHAR(255),
@.SUBJECT NVARCHAR(255),
@.BODY NVARCHAR(4000))
AS
DECLARE @.Object int
DECLARE @.Hresult int
DECLARE @.ErrorSource varchar (255)
DECLARE @.ErrorDesc varchar (255)
DECLARE @.V_BODY NVARCHAR(4000)

DECLARE @.hr int
DECLARE @.src varchar(255), @.desc varchar(255)

EXEC @.Hresult = sp_OACreate 'CDONTS.NewMail', @.Object OUT

IF @.Hresult = 0 begin
--SET SOME PROPERTIES

SET @.V_BODY = '' + @.BODY
EXEC @.Hresult = sp_OASetProperty @.Object, 'From', @.FROM
EXEC @.Hresult = sp_OASetProperty @.Object, 'To', @.TO
EXEC @.Hresult = sp_OASetProperty @.Object, 'Subject', @.SUBJECT
EXEC @.Hresult = sp_OASetProperty @.Object, 'Body', @.V_BODY

EXEC @.Hresult = sp_OASetProperty @.Object, 'MailFormat', 0

--CALL ATTACHMENT METHOD
EXEC @.Hresult = sp_OAMethod @.Object, 'Attachfile', 'C:\Inetpub\wwwroot\desarrollo\PolizasCP\PolC20031 103.txt', 'poliza.txt', 1

--CALL SEND METHOD
EXEC @.Hresult = sp_OAMethod @.Object, 'Send', NULL

--DESTROY THE OBJECT
EXEC @.Hresult = sp_OADestroy @.Object
end
else
begin
EXEC sp_OAGetErrorInfo @.object, @.src OUT, @.desc OUT
SELECT hr=convert(varbinary(4),@.hr), Source=@.src, Description=@.desc
end

Thanks in advance for your help

Here;s a sp which will make your life easier ...

CREATE PROCEDURE [dbo].[sp_CDOMail]
@.To varchar(1000),
@.From varchar(100),
@.Subject varchar(100),
@.Body varchar(4000),
@.CC varchar(100) = null,
@.BCC varchar(100) = null,
@.FilePath varchar(100) = Null, --inlcude last slash
@.FileName varchar(100) = Null

/************************************************** *******************

This stored procedure takes the above parameters and sends an e-mail.
All of the mail configurations are hard-coded in the stored procedure.
Comments are added to the stored procedure where necessary.
Reference to the CDOSYS objects are at the following MSDN Web site:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cdosys/html/_cdosys_messaging.asp

DATE By Descript
------ ------ ----------------
11/01/03 SP --Modified to Send Attachments from the original query designed by Microsoft.

************************************************** *********************/
AS
Declare @.iMsg int
Declare @.hr int
Declare @.source varchar(255)
Declare @.description varchar(500)
Declare @.output varchar(1000)

Declare @.attachment varchar(200)

set @.attachment = @.FilePath + @.FileName

--************* Create the CDO.Message Object ************************
EXEC @.hr = sp_OACreate 'CDO.Message', @.iMsg OUT

--***************Configuring the Message Object ******************
-- This is to configure a remote SMTP server.
-- http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cdosys/html/_cdosys_schema_configuration_sendusing.asp
EXEC @.hr = sp_OASetProperty @.iMsg, 'Configuration.fields("http://schemas.microsoft.com/cdo/configuration/sendusing").Value','2'
-- This is to configure the Server Name or IP address.
-- Replace MailServerName by the name or IP of your SMTP Server.
EXEC @.hr = sp_OASetProperty @.iMsg, 'Configuration.fields("http://schemas.microsoft.com/cdo/configuration/smtpserver").Value', 'Mozart'

-- Save the configurations to the message object.
EXEC @.hr = sp_OAMethod @.iMsg, 'Configuration.Fields.Update', null

-- Set the e-mail parameters.
EXEC @.hr = sp_OASetProperty @.iMsg, 'To', @.To
EXEC @.hr = sp_OASetProperty @.iMsg, 'From', @.From
EXEC @.hr = sp_OASetProperty @.iMsg, 'Subject', @.Subject
EXEC @.hr = sp_OASetProperty @.iMsg, 'CC', @.CC
EXEC @.hr = sp_OASetProperty @.iMsg, 'BCC', @.BCC

--Add Attachment if exists.
if @.Attachment <> ''
EXEC @.hr = sp_OAMethod @.iMsg, 'AddAttachment',null, @.Attachment , @.FileName

-- If you are using HTML e-mail, use 'HTMLBody' instead of 'TextBody'.
EXEC @.hr = sp_OASetProperty @.iMsg, 'TextBody', @.Body
EXEC @.hr = sp_OAMethod @.iMsg, 'Send', NULL

-- Sample error handling.
IF @.hr <>0
select @.hr
BEGIN
EXEC @.hr = sp_OAGetErrorInfo NULL, @.source OUT, @.description OUT
IF @.hr = 0
BEGIN
SELECT @.output = ' Source: ' + @.source
SELECT @.output = @.output + '
Description: ' + @.description
Select @.output
END
ELSE
BEGIN
PRINT ' sp_OAGetErrorInfo failed.'
RETURN
END
END

-- Do some error handling after each step if you need to.
-- Clean up the objects created.
EXEC @.hr = sp_OADestroy @.iMsg

GO

IF you still have problems email me @. shaileshpatangay@.hotmail.com

--shailesh|||Thanks a lot for your help

It's working now

Sunday, February 19, 2012

help with understanding transactional replication

Hi everybody,
I was told that for transactional replication (see posts below) I need to
have snapshot scheduled to run for instance each night. But i dont
understand this.
This is my way of thinking how transactional replication should be
initiated:
- logreader, snapshot and distributer are stopped
- logreader is started so that it captures transactions that snapshot might
miss out on
- run snapshot immediately after logreader is started.
- snapshot starts doing its thing (copying the schema and the data in the
tables of the ddatabase). If for example snapshot has already processed
TableA and a change in data is made to TableA, logreader will pick this
change up and record it.
- once snapshot has completed its task, the distributer is started. The
distributer moves the snapshot to its destination and then reindexes the
tables. Finally it processes those transactions captured by the logreader.
Is this right?
I cant understand why the snapshot agent should be scheduled for
transactional replication, if the logreader is processing all future
transactions. My thought was that:
initial_snapshot
+
ongoing_transactions (as processed by the logreader)
=
current state of database
So why is there is a need to schedule snapshot for transactional
replication?
Any help in clearing up any of my misconceptions would be fantastic!
cheers, john
"Hilary Cotter" <hilary.cotter@.gmail.com> wrote in message
news:%23$2wX4c7FHA.3648@.tk2msftngp13.phx.gbl...
> The snapshot agent should be scheduled, perhaps each hour, or at a time
> when there are few users on your system. Note that a snapshot will only be
> generated if a subscriber needs one. Otherwise no snapshot will be
> generated. So, the only time you need to start this agent is when a
> subscriber needs one.
> The log reader agent should be running continuously.
> I normally run the distributation agent continuously. It doesn't matter in
> which order you start it.
> --
> 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
> "john r" <johnr@.trailer.com> wrote in message
> news:ucO85ub7FHA.956@.TK2MSFTNGP10.phx.gbl...
>
John,
the snapshot agent runs for initialization and reinitialization only. If you
have loads of anonymous subscribers where you have no idea when they'll come
online, then perhaps there is a case for frequent snapshots (is this what
was being referred to by whoever it was who told you that the snapshot agent
needs to run every night?), but most likely this isn't the case for you. In
my setup, we have only ever run the snapshot agent once on some
publications. Certainly the snapshot agents are all disabled and only run
manually when necessary.
Cheers,
Paul Ibison SQL Server MVP, www.replicationanswers.com
(recommended sql server 2000 replication book:
http://www.nwsu.com/0974973602p.html)