Sunday, March 25, 2012
COPY DB
destination are both sql 2000. I'm getting the following error message.
CDW Database task Step Fails
Step Error Source: Microsoft Data Transformation Services (DTS) Package
Step Error Description:Unspecified error
Step Error code: 80004005
Step Error Help File:sqldts80.hlp
Step Error Help Context ID:1100
TASK DETAIL
FAILED TO CREATE THE SHARE OMWWIZC
The SQL Admin account has to have permissions to access teh file system on
the other machine, not just the other SQL Server.
Robert.
"sql" wrote:
> I'm trying to copy a database using the copy db wizard. The source and
> destination are both sql 2000. I'm getting the following error message.
> CDW Database task Step Fails
> Step Error Source: Microsoft Data Transformation Services (DTS) Package
> Step Error Description:Unspecified error
> Step Error code: 80004005
> Step Error Help File:sqldts80.hlp
> Step Error Help Context ID:1100
>
> TASK DETAIL
> FAILED TO CREATE THE SHARE OMWWIZC
COPY DB
destination are both sql 2000. I'm getting the following error message.
CDW Database task Step Fails
Step Error Source: Microsoft Data Transformation Services (DTS) Package
Step Error Description:Unspecified error
Step Error code: 80004005
Step Error Help File:sqldts80.hlp
Step Error Help Context ID:1100
TASK DETAIL
FAILED TO CREATE THE SHARE OMWWIZCThe SQL Admin account has to have permissions to access teh file system on
the other machine, not just the other SQL Server.
Robert.
"sql" wrote:
> I'm trying to copy a database using the copy db wizard. The source and
> destination are both sql 2000. I'm getting the following error message.
> CDW Database task Step Fails
> Step Error Source: Microsoft Data Transformation Services (DTS) Package
> Step Error Description:Unspecified error
> Step Error code: 80004005
> Step Error Help File:sqldts80.hlp
> Step Error Help Context ID:1100
>
> TASK DETAIL
> FAILED TO CREATE THE SHARE OMWWIZC
COPY DB
destination are both sql 2000. I'm getting the following error message.
CDW Database task Step Fails
Step Error Source: Microsoft Data Transformation Services (DTS) Package
Step Error Description:Unspecified error
Step Error code: 80004005
Step Error Help File:sqldts80.hlp
Step Error Help Context ID:1100
TASK DETAIL
FAILED TO CREATE THE SHARE OMWWIZCThe SQL Admin account has to have permissions to access teh file system on
the other machine, not just the other SQL Server.
Robert.
"sql" wrote:
> I'm trying to copy a database using the copy db wizard. The source and
> destination are both sql 2000. I'm getting the following error message.
> CDW Database task Step Fails
> Step Error Source: Microsoft Data Transformation Services (DTS) Package
> Step Error Description:Unspecified error
> Step Error code: 80004005
> Step Error Help File:sqldts80.hlp
> Step Error Help Context ID:1100
>
> TASK DETAIL
> FAILED TO CREATE THE SHARE OMWWIZC
Thursday, March 22, 2012
Copy Database Wizard Timeout Error
Hi,
I am copying a database from one server to the other. Both have SQL 2005. When using the CDW, I get the following error after 10 minutes:
Event Name: OnError
Message: An exception occurred while executing a Transact-SQL statement or batch.
StackTrace: at Microsoft.SqlServer.Management.Common.ServerConnection.ExecuteWithResults(String sqlCommand)
at Microsoft.SqlServer.Management.Common.ServerConnection.ExecuteWithResults(StringCollection sqlCommands)
at Microsoft.SqlServer.Dts.Tasks.TransferObjectsTask.TransferObjectsTask.TransferDatabasesUsingSMOTransfer()
InnerException-->Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.
CREATE DATABASE failed. Some file names listed could not be created. Check related errors.
It always errors at 10 minutes. But, when I run the Create Database statement from my query analyzer, it works and it takes about 18 minutes.
How do I get the CDW to wait longer than 10 minutes before returning an error?
I have set my remote query timeout to 20 minutes and that didn't seem to have any effect.
Thanks,
--ExoStatic
Have you installed Service PAck 2? CDW is much improved.
Download SQL Server 2005 Service Pack 2 at:
http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/servicepacks/sp2.mspx
...probably doesn't matter but the job runs on the destination server so it timeouts are relevent they may need to be set on that server.
|||We have greatly improved SMO transfer in CDW with Service Pack 2. I strongly suggest you try that. Also, you could try using the detach/attach method instead of SMO Transfer. I believe it is faster and more reliable.
After installing Service Pack 2, please let us know if your problem persists. You may still have to change some settings on your server.
Paul A. Mestemaker II
Program Manager
Microsoft SQL Server Manageability
http://blogs.msdn.com/sqlrem/
if you use Detach/attach method you still need to migrate the Login from Source Server. You can also try Backup/Restore method which is best in such scenario. in this method also the Logins has to be taken care.
To transfer login Refer :http://support.microsoft.com/default.aspx/kb/246133
Madhu
sqlsql
Tuesday, March 20, 2012
Copy Database Wizard
database to SQL Server 2005 using copy database wizard.
When I use copy database wizard on the PUBS database the transfer is
successful.
ERROR:
Event Type:Error
Event Source:SQLISPackage
Event Category:None
Event ID:12550
Date:4/3/2006
Time:11:30:12 AM
User:IPC\Administrator
Computer:SQLSERV
Description:
Event Name: OnError
Message: ERROR : errorCode=-1073548784 description=Executing the query
"EXEC dbo.sp_grantdbaccess @.loginame = N'webapp', @.name_in_db = N'webapp'
" failed with the following error: "'webapp' is not a valid login or you do
not have permission.". Possible failure reasons: Problems with the query,
"ResultSet" property not set correctly, parameters not set correctly, or
connection not established correctly.
helpFile= helpContext=0
idofInterfaceWithError={8BDFE893-E9D8-4D23-9739-DA807BCDC2AC}
StackTrace: at
Microsoft.SqlServer.Management.Dts.DtsTransferProv ider.ExecuteTransfer()
at Microsoft.SqlServer.Management.Smo.Transfer.Transf erData()
at
Microsoft.SqlServer.Dts.Tasks.TransferObjectsTask. TransferObjectsTask.TransferDatabasesUsingSMOTrans fer()
Operator: IPC\Administrator
Source Name: IPC-DB_SQLSERV_Transfer Objects Task
Source ID: {8C9DDAF1-33A1-4FE0-A062-96D4185442B2}
Execution ID: {B0E899B3-B153-4B2D-8904-8D3137759A41}
Start Time: 4/3/2006 11:30:12 AM
End Time: 4/3/2006 11:30:12 AM
Data Code: 0
For more information, see Help and Support Center at
http://go.microsoft.com/fwlink/events.asp.
Just by reading the error, it looks like there is an issue with the webapp
login, which could be related to the security context (your permissions)
Do you have full permissions?
"Terry" wrote:
> I am receiving the following error when attempting to copy a SQL Server 2000
> database to SQL Server 2005 using copy database wizard.
> When I use copy database wizard on the PUBS database the transfer is
> successful.
>
> ERROR:
> Event Type:Error
> Event Source:SQLISPackage
> Event Category:None
> Event ID:12550
> Date:4/3/2006
> Time:11:30:12 AM
> User:IPC\Administrator
> Computer:SQLSERV
> Description:
> Event Name: OnError
> Message: ERROR : errorCode=-1073548784 description=Executing the query
> "EXEC dbo.sp_grantdbaccess @.loginame = N'webapp', @.name_in_db = N'webapp'
> " failed with the following error: "'webapp' is not a valid login or you do
> not have permission.". Possible failure reasons: Problems with the query,
> "ResultSet" property not set correctly, parameters not set correctly, or
> connection not established correctly.
> helpFile= helpContext=0
> idofInterfaceWithError={8BDFE893-E9D8-4D23-9739-DA807BCDC2AC}
> StackTrace: at
> Microsoft.SqlServer.Management.Dts.DtsTransferProv ider.ExecuteTransfer()
> at Microsoft.SqlServer.Management.Smo.Transfer.Transf erData()
> at
> Microsoft.SqlServer.Dts.Tasks.TransferObjectsTask. TransferObjectsTask.TransferDatabasesUsingSMOTrans fer()
> Operator: IPC\Administrator
> Source Name: IPC-DB_SQLSERV_Transfer Objects Task
> Source ID: {8C9DDAF1-33A1-4FE0-A062-96D4185442B2}
> Execution ID: {B0E899B3-B153-4B2D-8904-8D3137759A41}
> Start Time: 4/3/2006 11:30:12 AM
> End Time: 4/3/2006 11:30:12 AM
> Data Code: 0
> For more information, see Help and Support Center at
> http://go.microsoft.com/fwlink/events.asp.
>
Copy Database Wizard
database to SQL Server 2005 using copy database wizard.
When I use copy database wizard on the PUBS database the transfer is
successful.
ERROR:
Event Type: Error
Event Source: SQLISPackage
Event Category: None
Event ID: 12550
Date: 4/3/2006
Time: 11:30:12 AM
User: IPC\Administrator
Computer: SQLSERV
Description:
Event Name: OnError
Message: ERROR : errorCode=-1073548784 description=Executing the query
"EXEC dbo.sp_grantdbaccess @.loginame = N'webapp', @.name_in_db = N'webapp'
" failed with the following error: "'webapp' is not a valid login or you do
not have permission.". Possible failure reasons: Problems with the query,
"ResultSet" property not set correctly, parameters not set correctly, or
connection not established correctly.
helpFile= helpContext=0
idofInterfaceWithError={8BDFE893-E9D8-4D23-9739-DA807BCDC2AC}
StackTrace: at
Microsoft.SqlServer.Management.Dts.DtsTransferProvider.ExecuteTransfer()
at Microsoft.SqlServer.Management.Smo.Transfer.TransferData()
at
Microsoft.SqlServer.Dts.Tasks.TransferObjectsTask.TransferObjectsTask.TransferDatabasesUsingSMOTransfer()
Operator: IPC\Administrator
Source Name: IPC-DB_SQLSERV_Transfer Objects Task
Source ID: {8C9DDAF1-33A1-4FE0-A062-96D4185442B2}
Execution ID: {B0E899B3-B153-4B2D-8904-8D3137759A41}
Start Time: 4/3/2006 11:30:12 AM
End Time: 4/3/2006 11:30:12 AM
Data Code: 0
For more information, see Help and Support Center at
http://go.microsoft.com/fwlink/events.asp.Just by reading the error, it looks like there is an issue with the webapp
login, which could be related to the security context (your permissions)
Do you have full permissions?
"Terry" wrote:
> I am receiving the following error when attempting to copy a SQL Server 2000
> database to SQL Server 2005 using copy database wizard.
> When I use copy database wizard on the PUBS database the transfer is
> successful.
>
> ERROR:
> Event Type: Error
> Event Source: SQLISPackage
> Event Category: None
> Event ID: 12550
> Date: 4/3/2006
> Time: 11:30:12 AM
> User: IPC\Administrator
> Computer: SQLSERV
> Description:
> Event Name: OnError
> Message: ERROR : errorCode=-1073548784 description=Executing the query
> "EXEC dbo.sp_grantdbaccess @.loginame = N'webapp', @.name_in_db = N'webapp'
> " failed with the following error: "'webapp' is not a valid login or you do
> not have permission.". Possible failure reasons: Problems with the query,
> "ResultSet" property not set correctly, parameters not set correctly, or
> connection not established correctly.
> helpFile= helpContext=0
> idofInterfaceWithError={8BDFE893-E9D8-4D23-9739-DA807BCDC2AC}
> StackTrace: at
> Microsoft.SqlServer.Management.Dts.DtsTransferProvider.ExecuteTransfer()
> at Microsoft.SqlServer.Management.Smo.Transfer.TransferData()
> at
> Microsoft.SqlServer.Dts.Tasks.TransferObjectsTask.TransferObjectsTask.TransferDatabasesUsingSMOTransfer()
> Operator: IPC\Administrator
> Source Name: IPC-DB_SQLSERV_Transfer Objects Task
> Source ID: {8C9DDAF1-33A1-4FE0-A062-96D4185442B2}
> Execution ID: {B0E899B3-B153-4B2D-8904-8D3137759A41}
> Start Time: 4/3/2006 11:30:12 AM
> End Time: 4/3/2006 11:30:12 AM
> Data Code: 0
> For more information, see Help and Support Center at
> http://go.microsoft.com/fwlink/events.asp.
>
Copy Database Wizard
database to SQL Server 2005 using copy database wizard.
When I use copy database wizard on the PUBS database the transfer is
successful.
ERROR:
Event Type: Error
Event Source: SQLISPackage
Event Category: None
Event ID: 12550
Date: 4/3/2006
Time: 11:30:12 AM
User: IPC\Administrator
Computer: SQLSERV
Description:
Event Name: OnError
Message: ERROR : errorCode=-1073548784 description=Executing the query
"EXEC dbo.sp_grantdbaccess @.loginame = N'webapp', @.name_in_db = N'webapp'
" failed with the following error: "'webapp' is not a valid login or you do
not have permission.". Possible failure reasons: Problems with the query,
"ResultSet" property not set correctly, parameters not set correctly, or
connection not established correctly.
helpFile= helpContext=0
idofInterfaceWithError={8BDFE893-E9D8-4D23-9739-DA807BCDC2AC}
StackTrace: at
Microsoft.SqlServer.Management.Dts.DtsTransferProvider.ExecuteTransfer()
at Microsoft.SqlServer.Management.Smo.Transfer.TransferData()
at
Microsoft.SqlServer.Dts.Tasks.TransferObjectsTask.TransferObjectsTask.Transf
erDatabasesUsingSMOTransfer()
Operator: IPC\Administrator
Source Name: IPC-DB_SQLSERV_Transfer Objects Task
Source ID: {8C9DDAF1-33A1-4FE0-A062-96D4185442B2}
Execution ID: {B0E899B3-B153-4B2D-8904-8D3137759A41}
Start Time: 4/3/2006 11:30:12 AM
End Time: 4/3/2006 11:30:12 AM
Data Code: 0
For more information, see Help and Support Center at
http://go.microsoft.com/fwlink/events.asp.Just by reading the error, it looks like there is an issue with the webapp
login, which could be related to the security context (your permissions)
Do you have full permissions?
"Terry" wrote:
> I am receiving the following error when attempting to copy a SQL Server 20
00
> database to SQL Server 2005 using copy database wizard.
> When I use copy database wizard on the PUBS database the transfer is
> successful.
>
> ERROR:
> Event Type: Error
> Event Source: SQLISPackage
> Event Category: None
> Event ID: 12550
> Date: 4/3/2006
> Time: 11:30:12 AM
> User: IPC\Administrator
> Computer: SQLSERV
> Description:
> Event Name: OnError
> Message: ERROR : errorCode=-1073548784 description=Executing the query
> "EXEC dbo.sp_grantdbaccess @.loginame = N'webapp', @.name_in_db = N'webapp'
> " failed with the following error: "'webapp' is not a valid login or you d
o
> not have permission.". Possible failure reasons: Problems with the query,
> "ResultSet" property not set correctly, parameters not set correctly, or
> connection not established correctly.
> helpFile= helpContext=0
> idofInterfaceWithError={8BDFE893-E9D8-4D23-9739-DA807BCDC2AC}
> StackTrace: at
> Microsoft.SqlServer.Management.Dts.DtsTransferProvider.ExecuteTransfer()
> at Microsoft.SqlServer.Management.Smo.Transfer.TransferData()
> at
> Microsoft.SqlServer.Dts.Tasks.TransferObjectsTask.TransferObjectsTask.Tran
sferDatabasesUsingSMOTransfer()
> Operator: IPC\Administrator
> Source Name: IPC-DB_SQLSERV_Transfer Objects Task
> Source ID: {8C9DDAF1-33A1-4FE0-A062-96D4185442B2}
> Execution ID: {B0E899B3-B153-4B2D-8904-8D3137759A41}
> Start Time: 4/3/2006 11:30:12 AM
> End Time: 4/3/2006 11:30:12 AM
> Data Code: 0
> For more information, see Help and Support Center at
> http://go.microsoft.com/fwlink/events.asp.
>
Monday, March 19, 2012
Copy Database Login Timout Expired
Hi,
I get the following error when I use the Copy Database Wizard. Tried searching for solutions but didn't find anything. One thing that caught my attention during the wizard was the "Package Location" dir. In my wizard it is greyed out and when I go to look on the server, that is where I am copying the database onto, that directory doesn't exist. Maybe that is causing it? I don't know. Really frustarted here. This looks like a very generic error to me but I don't know where to look because I'm still a M$ server newbie here. Thanks for your help.
TITLE: Copy Database Wizard
While trying to find a folder on SQL an OLE DB error was encountered with error code 0x80004005 (Login timeout expired).
ADDITIONAL INFORMATION:
While trying to find a folder on SQL an OLE DB error was encountered with error code 0x80004005 (Login timeout expired).
BUTTONS:
OK
Is this a really simple question that no one wants to answer? I ask because I saw someone else who posted the exact same problem and was never answered?
Thanks
|||Unfortunately, there aren't enough details for us to answer the question.
What version of SQL Server are you using? If you run "SELECT @.@.Version" you will see what is installed.
We have made vast improvements in the Copy Database Wizard for SQL Server 2005 SP2. A CTP of SP2 will be released soon.
Paul A. Mestemaker II
Program Manager
Microsoft SQL Server Manageability
http://blogs.msdn.com/sqlrem/
Hi,
This is my version: Microsoft SQL Server 2005 - 9.00.1399.06 (Intel X86) Oct 14 2005 00:33:37 Copyright (c) 1988-2005 Microsoft Corporation Developer Edition on Windows NT 5.1 (Build 2600: Service Pack 2).
I've found another way to do what I want it to do so I'm fine for now. I will wait for SP2.
Thank you.
Copy Database from v8 to v9 SQL Server
Hi dear devs, admins or users!
I have following problem with the "SQL Server 2005 Developer Edition". I am in a small network and try to copy a database from a version 8.0 to a version 9.0 "SQL Server" (2 computers). I use the "Copy Database Wizard" and the process did 4 from 5 actions correctly, the last action with the name "Execute SQL Server Agent Job" fails allways. My "SQL Server Agent" process is started and runs well. In real I don't need the "SQL Server Agent" in any way in my database, so I don't understand why this process generates this error. I try to copy this old "Portal" "ASP.NET 1.1" database to my new "SQL Server 2005". Can someone help me?.
Thanks
Arzu Bazman · «US DEV United Systems»
You can try to detach your database in SQL Server 2000 and go to the folder where your database's .mdf and .ldf are located to copy them. Then paste the copied files to your SQL Server 2005 data file folder (somewhere like: C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\). Go to the MS management Studio and retach the database. The database should be ready to go.
Or you can back up your database and restore it in your new server.
HTH.
|||
msbazman:
Hi dear devs, admins or users!
I have following problem with the "SQL Server 2005 Developer Edition". I am in a small network and try to copy a database from a version 8.0 to a version 9.0 "SQL Server" (2 computers). I use the "Copy Database Wizard" and the process did 4 from 5 actions correctly, the last action with the name "Execute SQL Server Agent Job" fails allways. My "SQL Server Agent" process is started and runs well. In real I don't need the "SQL Server Agent" in any way in my database, so I don't understand why this process generates this error. I try to copy this old "Portal" "ASP.NET 1.1" database to my new "SQL Server 2005". Can someone help me?.
Thanks
Arzu Bazman · «US DEV United Systems»
The Agent is not related unless you tried to schedule the move, here is what you do depending on your needs, register the 2000 with the 2005 in Management Studio right click all task then Backup the database in 2000 locally and then restore it in the 2005 in the Backup and Restore wizard choose the restore from device option, SQL Server will ask you if you want to keep 2000 compatibility choose what you need. Hope this helps.
Copy database from one server to a different server
I am trying to copy a database from one server to another using copy database wizard. However, in the process, I am receiving the following error message : 'Your Sql Server Service is running under the local system account. You need to change your sql server Service account to have the rights to copy files over the network.'
I have no idea how to handle this. Any help is greatly appreciated. Thanks in advance.Hi
You may want to check out alternative methods:
http://support.microsoft.com/default.aspx?scid=kb;en-us;Q314546
The service account seems can be found either the services applet or
Enterprise Manager.
John
"John" <john_si100@.yahoo.com> wrote in message
news:05CD7ACF-B765-468A-B9FD-BA501C286A89@.microsoft.com...
> Hi,
> I am trying to copy a database from one server to another using copy
database wizard. However, in the process, I am receiving the following error
message : 'Your Sql Server Service is running under the local system
account. You need to change your sql server Service account to have the
rights to copy files over the network.'
> I have no idea how to handle this. Any help is greatly appreciated. Thanks
in advance.|||Create a domain login for SQL Server... THen using SQL Enterprise Manager
right click your server-> Properties->Security and set the login and
password that you have just created...
Then give that NT login permissions on the appropriate files to do the copy
and you are done.
--
Wayne Snyder, MCDBA, SQL Server MVP
Computer Education Services Corporation (CESC), Charlotte, NC
www.computeredservices.com
(Please respond only to the newsgroups.)
I support the Professional Association of SQL Server (PASS) and it's
community of SQL Server professionals.
www.sqlpass.org
"John" <john_si100@.yahoo.com> wrote in message
news:05CD7ACF-B765-468A-B9FD-BA501C286A89@.microsoft.com...
> Hi,
> I am trying to copy a database from one server to another using copy
database wizard. However, in the process, I am receiving the following error
message : 'Your Sql Server Service is running under the local system
account. You need to change your sql server Service account to have the
rights to copy files over the network.'
> I have no idea how to handle this. Any help is greatly appreciated. Thanks
in advance.
Thursday, March 8, 2012
Copy current record
Tablename "tblAppDetails"
Which includes the following fields
AppDate smalldatetime, Apptime varchar 10 (both make the PK), AppName
varchar 100, AppAddress1 varchar 100
What I'd like are 2 SP's, the first to select the all the fields (other than
AppDate & AppTime) for the current record and the second to paste those
values onto another record in the same table (this is for moving someone fro
m
one appointment to another. The user sees one record to view and'll click a
button to copy, select a new record and click another button to paste) .
Is this something to do with Fetch?
Many thanks
PaulPaul in Harrow wrote:
> Hi There
> Tablename "tblAppDetails"
> Which includes the following fields
> AppDate smalldatetime, Apptime varchar 10 (both make the PK), AppName
> varchar 100, AppAddress1 varchar 100
> What I'd like are 2 SP's, the first to select the all the fields
> (other than AppDate & AppTime) for the current record and the second
> to paste those values onto another record in the same table (this is
> for moving someone from one appointment to another. The user sees one
> record to view and'll click a button to copy, select a new record and
> click another button to paste) .
> Is this something to do with Fetch?
> Many thanks
> Paul
The PK in the table seems a little iffy. What prevents two records from
having the same date and time?
With that PK, why not just change the date and time to make the change.
I assume by "current record" you mean a row of data that a user is
editing. I'm not sure what you mean by "another record" because of the
PK.
Could you explain in a little more detail what data you want to move,
where it's going and if any other tables are involved in the process.
David Gugick
Imceda Software
www.imceda.com|||You don't need cursors and multiple SPs. A single UPDATE will do it:
UPDATE tblAppDetails
SET appname =
(SELECT appname
FROM tblAppDetails
WHERE appdate = @.ad1
AND apptime = @.at1),
(SELECT appaddress1
FROM tblAppDetails
WHERE appdate = @.ad1
AND apptime = @.at1)
WHERE appdate = @.ad2
AND apptime = @.at2
(@.ad1, @.at1) and (@.ad2, @.at2) specify the key values of the source and
target rows respectively.
Why are you using separate columns for date and time when SMALLDATETIME
stores both?
David Portas
SQL Server MVP
--|||Thanks both Davids
"David Portas" wrote:
"Why are you using separate columns for date and time when SMALLDATETIME
stores both?"
I know, but this is not my table and it's been pre-filled with 24 AppTimes
for each AppDate for the next five years!
"(@.ad1, @.at1) and (@.ad2, @.at2) specify the key values of the source and
target rows respectively."
Er, how? @.ad1 &@.at1 are from the current record but how does it know which
is the second record?|||In my query you need to specify the keys for both the source row and
the target row (@.ad1, @.at1) and (@.ad2, @.at2). What do you mean by
"second row"? You didn't specify how the target row for the change is
to be determined so I assumed you were supplying that information as
parameters in your SP. If you wanted something else then please give us
a full description of the problem: DDL, sample data INSERT statements
and show your required end result. See:
http://www.aspfaq.com/etiquette.asp?id=5006
David Portas
SQL Server MVP
--|||David,
I'll do all this on Monday
Paul
"David Portas" wrote:
> In my query you need to specify the keys for both the source row and
> the target row (@.ad1, @.at1) and (@.ad2, @.at2). What do you mean by
> "second row"? You didn't specify how the target row for the change is
> to be determined so I assumed you were supplying that information as
> parameters in your SP. If you wanted something else then please give us
> a full description of the problem: DDL, sample data INSERT statements
> and show your required end result. See:
> http://www.aspfaq.com/etiquette.asp?id=5006
> --
> David Portas
> SQL Server MVP
> --
>
Saturday, February 25, 2012
Copy a BLOB field in a stored-procedure from
I try to run the following query:
Update DestTable
set DestBLOB = (select SourceBLOB from SourceTable where SourceTableID = 123)
Where DestTableID = 321
I always get the error message that this is not possible with image data.
Does anyone know a solution on how to copy a BLOB from one table to another?
I tried with WRITETEXT but this does not work either.
Many thanks
Thomas (thomas.steiner@.novaesprit.ch)Can you post your WRITETEXT code please.
Rick
"Groswesir" <Groswesir@.discussions.microsoft.com> wrote in message
news:A6217B40-987E-485B-A55A-3F97167B8A93@.microsoft.com...
> Hello
> I try to run the following query:
> Update DestTable
> set DestBLOB = (select SourceBLOB from SourceTable where SourceTableID =123)
> Where DestTableID = 321
> I always get the error message that this is not possible with image data.
> Does anyone know a solution on how to copy a BLOB from one table to
another?
> I tried with WRITETEXT but this does not work either.
> Many thanks
> Thomas (thomas.steiner@.novaesprit.ch)|||Here it is:
Declare @.ptrval binary(16)
SELECT @.ptrval = TEXTPTR(content)
FROM SambaReports_Test.dbo.Documents
Where DocumentID = 171
WRITETEXT SambaReports_Test.dbo.Documents.content @.ptrval (Select
RequestDataBody from RequestData where RequestID = 2328)
This results in a 'missing datastream' error. When I put a text-string
instead of the select-statement it works.
Thomas
"Rick Sawtell" wrote:
> Can you post your WRITETEXT code please.
> Rick
>
> "Groswesir" <Groswesir@.discussions.microsoft.com> wrote in message
> news:A6217B40-987E-485B-A55A-3F97167B8A93@.microsoft.com...
> > Hello
> > I try to run the following query:
> >
> > Update DestTable
> > set DestBLOB = (select SourceBLOB from SourceTable where SourceTableID => 123)
> > Where DestTableID = 321
> >
> > I always get the error message that this is not possible with image data.
> > Does anyone know a solution on how to copy a BLOB from one table to
> another?
> > I tried with WRITETEXT but this does not work either.
> >
> > Many thanks
> >
> > Thomas (thomas.steiner@.novaesprit.ch)
>
>|||AFAIK, you can't pass a subquery to UPDATETEXT. The script below shows how
to copy text data between tables. If your data type is ntext, you'll need
to add calculations to allow 2 bytes per character.
DECLARE @.ptrval binary(16),
@.StartIndex int,
@.RequestDataBodyLength int,
@.RequestDataBody varchar(8000)
--clear any existing data and init text pointer
UPDATE Documents
SET content = NULL
WHERE DocumentID = 171
SET @.StartIndex = 0
--get length of data to copy
SELECT @.RequestDataBodyLength = DATALENGTH(RequestDataBody)
FROM RequestData
WHERE RequestID = 2328
--get text pointer
SELECT @.ptrval = TEXTPTR(content)
FROM Documents
WHERE DocumentID = 171
--copy data in chunks of 8000
WHILE @.StartIndex < @.RequestDataBodyLength
BEGIN
SELECT @.RequestDataBody = SUBSTRING(RequestDataBody, @.StartIndex, 8000)
FROM RequestData
WHERE RequestID = 2328
UPDATETEXT Documents.content @.ptrval @.StartIndex 0 @.RequestDataBody
SET @.StartIndex = @.StartIndex + DATALENGTH(@.RequestDataBody)
END
--
Hope this helps.
Dan Guzman
SQL Server MVP
"Grosswesir" <Grosswesir@.discussions.microsoft.com> wrote in message
news:73535098-61B7-4BEC-88AC-B125C0F5155C@.microsoft.com...
> Here it is:
> Declare @.ptrval binary(16)
> SELECT @.ptrval = TEXTPTR(content)
> FROM SambaReports_Test.dbo.Documents
> Where DocumentID = 171
> WRITETEXT SambaReports_Test.dbo.Documents.content @.ptrval (Select
> RequestDataBody from RequestData where RequestID = 2328)
> This results in a 'missing datastream' error. When I put a text-string
> instead of the select-statement it works.
> Thomas
> "Rick Sawtell" wrote:
>> Can you post your WRITETEXT code please.
>> Rick
>>
>> "Groswesir" <Groswesir@.discussions.microsoft.com> wrote in message
>> news:A6217B40-987E-485B-A55A-3F97167B8A93@.microsoft.com...
>> > Hello
>> > I try to run the following query:
>> >
>> > Update DestTable
>> > set DestBLOB = (select SourceBLOB from SourceTable where SourceTableID
>> > =>> 123)
>> > Where DestTableID = 321
>> >
>> > I always get the error message that this is not possible with image
>> > data.
>> > Does anyone know a solution on how to copy a BLOB from one table to
>> another?
>> > I tried with WRITETEXT but this does not work either.
>> >
>> > Many thanks
>> >
>> > Thomas (thomas.steiner@.novaesprit.ch)
>>|||Hi Dan
It works fine! Thanks a lot.
However I had to change the line:
SUBSTRING(RequestDataBody, @.StartIndex, 8000)
to
SUBSTRING(RequestDataBody, @.StartIndex+1, 8000)
Best regards
Thomas
"Dan Guzman" wrote:
> AFAIK, you can't pass a subquery to UPDATETEXT. The script below shows how
> to copy text data between tables. If your data type is ntext, you'll need
> to add calculations to allow 2 bytes per character.
>
> DECLARE @.ptrval binary(16),
> @.StartIndex int,
> @.RequestDataBodyLength int,
> @.RequestDataBody varchar(8000)
> --clear any existing data and init text pointer
> UPDATE Documents
> SET content = NULL
> WHERE DocumentID = 171
> SET @.StartIndex = 0
> --get length of data to copy
> SELECT @.RequestDataBodyLength = DATALENGTH(RequestDataBody)
> FROM RequestData
> WHERE RequestID = 2328
> --get text pointer
> SELECT @.ptrval = TEXTPTR(content)
> FROM Documents
> WHERE DocumentID = 171
> --copy data in chunks of 8000
> WHILE @.StartIndex < @.RequestDataBodyLength
> BEGIN
> SELECT @.RequestDataBody => SUBSTRING(RequestDataBody, @.StartIndex, 8000)
> FROM RequestData
> WHERE RequestID = 2328
> UPDATETEXT Documents.content @.ptrval @.StartIndex 0 @.RequestDataBody
> SET @.StartIndex = @.StartIndex + DATALENGTH(@.RequestDataBody)
> END
> --
> Hope this helps.
> Dan Guzman
> SQL Server MVP
> "Grosswesir" <Grosswesir@.discussions.microsoft.com> wrote in message
> news:73535098-61B7-4BEC-88AC-B125C0F5155C@.microsoft.com...
> > Here it is:
> >
> > Declare @.ptrval binary(16)
> >
> > SELECT @.ptrval = TEXTPTR(content)
> > FROM SambaReports_Test.dbo.Documents
> > Where DocumentID = 171
> > WRITETEXT SambaReports_Test.dbo.Documents.content @.ptrval (Select
> > RequestDataBody from RequestData where RequestID = 2328)
> >
> > This results in a 'missing datastream' error. When I put a text-string
> > instead of the select-statement it works.
> >
> > Thomas
> >
> > "Rick Sawtell" wrote:
> >
> >> Can you post your WRITETEXT code please.
> >>
> >> Rick
> >>
> >>
> >> "Groswesir" <Groswesir@.discussions.microsoft.com> wrote in message
> >> news:A6217B40-987E-485B-A55A-3F97167B8A93@.microsoft.com...
> >> > Hello
> >> > I try to run the following query:
> >> >
> >> > Update DestTable
> >> > set DestBLOB = (select SourceBLOB from SourceTable where SourceTableID
> >> > => >> 123)
> >> > Where DestTableID = 321
> >> >
> >> > I always get the error message that this is not possible with image
> >> > data.
> >> > Does anyone know a solution on how to copy a BLOB from one table to
> >> another?
> >> > I tried with WRITETEXT but this does not work either.
> >> >
> >> > Many thanks
> >> >
> >> > Thomas (thomas.steiner@.novaesprit.ch)
> >>
> >>
> >>
>
>
Friday, February 24, 2012
Converting/Casting strings into Datetime datatype
Hello,
I have a varchar column that inludes dates in the following fomat: 03032007? When I try to cast this to datetime, I keep getting "Arithmetic overflow error converting expression to data type datetime." error. Maybe someone has some ideas how to handle this?
Thanks!
If you had only stored your date values in the ISO format of YYYYMMDD, they would easily cast or convert to datetime. -Or even left in one of the standard date delimiters, such as [ / - ].
However, you (or some unnamed 'other' person) made up a oddball format, and now you will have to 'handle' it to create a 'real' date value everytime you need to use it.
(This assumes your format is MMDDYYYY.)
SELECT cast( stuff( stuff( '03032007', 3, 0, '/' ), 6, 0, '/' ) AS datetime )
-
2007-03-03 00:00:00.000
|||
You know that MS stores sqlagent datetime in to two int columns with the following format, right? (Take a look at the schema for msdb: sysalerts,sysjobhistory, sysjobschedules, sysjobservers, and sysjobsteps.)
date: YYYYMMDD
time: HHMMSS
So, it's not that weird to see the public employs such schema.
|||But I also notice that MS stores SQL Agent datetime in ISO format (YYYYMMDD).
That little 'standard' makes a lot of difference in cast/convert.
That is behind my even mentioning using a standard ISO format in my response...
Converting varchar to datetime
June 16
Can I convert that from varchar to datetime or smalldatetime without loss of data? And, if so, what adjustments do I have to make in my ado code to continue to allow my clients to add data. Currently they add date data by selecting a month from one dropdown and the day from another.
Thanks!Create another column and use CONVERT function to conver the date and store. Then delete the old column.
Sunday, February 19, 2012
Converting T-SQL *= OUTER JOINS to ANSI-92 syntax
FROM tbl_participation, tbl_adult, tbl_month, tbl_school_year
WHERE tbl_participation.adult_ID =* tbl_adult.ID
AND tbl_participation.month_ID =* tbl_month.ID
AND tbl_participation.year_id =* tbl_school_year.ID
AND tbl_school_year.ID = 5
It works just fine, as I want the results to include a table with one column containing the month name, the table headed by the adult's name/school year. It needs to still return a table even if there have yet been no records in tbl_participation for that adult/month/year.
However, the following is my best shot at making the query ANSI-92 compliant, as when I implement SQL Server 2005 I don't want to have to go back and change compatibility modes:
FROM ((tbl_adult
LEFT OUTER JOIN tbl_participation ON tbl_participation.adult_ID = tbl_adult.ID)
RIGHT OUTER JOIN tbl_month ON tbl_participation.month_ID = tbl_month.ID)
RIGHT OUTER JOIN tbl_school_year ON tbl_participation.year_id = tbl_school_year.ID
AND tbl_school_year.ID = 5
This query works fine if there is any data in tbl_participation for adult 8 and school year 5. But if nothing has yet been entered, it returns nothing. I need it to work like the older T-SQL iteration, and still return a list of the 12 months and the adult's name even if no participation data has been entered.
Thanks - this one has got me pulling my hair out.
With the JOIN clause, you should logically think of the ON clause as being evaluated first followed by WHERE clause, GROUP BY and HAVING clause. Note that with inner joins the optimizer can evaluate predicates in the WHERE and ON clause together. But when you outer joins the WHERE clause is always evaluated after the ON clause. So this will essentially prevent non-matching rows from being produced based on your example. Additionally, it also depends on whether you filter the rows before the outer join. So in your example, you need to move the tbl_adult.ID check to FROM clause using a derived table like:
FROM (( (select * from tbl_adult where ID = 8) as a
LEFT OUTER JOIN tbl_participation as p ON p.adult_ID = a.ID)
RIGHT OUTER JOIN tbl_month as m ON p.month_ID = m.ID)
RIGHT OUTER JOIN tbl_school_year as y ON p.year_id = y.ID
WHERE y.ID = 5
converting to numeric (6,3)
Hey guys,
I am trying to achive the following:
Truncate the values 1680.390000000000000000
to numeric (6,3)
All works ok until i hit a value over 1000, (as above)
The code i was using is:
cos1 = 1680.390000000000000000000
CONVERT (NUMERIC(6 , 3), ROUND(COS1, 3))
I have tried a few others, but nothing seems to work..
I get the following error. "Arithmatic Overflow"
Has anyone got any suggestions?
Thanks guys,
Scotty
A numeric(6,3) would only accept a number as large as 999.999 -six digits total, three digits to the right of the decimal.
Your value, 1680.xxxx exceeds the maximum size and creates an overflow condition -resulting in an error.
Perhaps you need a larger number, like maybe, just guessing here, numeric(8,3)?
|||Brilliant!!!!
thanks vry much Archie.. this has been confusing me all day,, the way they explain it looks to me as 6 to the left, and 3 to the right...
Thanks again
Scotty
Converting to ANSI joins
It may be already but I'm suspecting the "WHERE t2.table_id =
t1.table_id" means it isn't. I tried things like the bottom query but
the number of records returned doesn't match. Any help would be
appreciated. I can't give the DDL or test date cause this is a
simplification of the actual query. Thanks a lot!
SELECT DISTINCT t1.table_id
FROM mytable t1
WHERE (t1.username = 'john')
AND (NOT EXISTS (SELECT * FROM mytable t2 WHERE t2.table_id =
t1.table_id AND t2.username <> 'john'))
-- my attempt --
SELECT DISTINCT t1.table_id
FROM mytable t1
INNER JOIN mytable t2 ON t2.table_id = t1.table_id AND t2.username =
'john'
WHERE (t1.username = 'john')It's not a JOIN but a correlated subquery. It is possible to replace this
clause with a LEFT JOIN and testing for the presence of the null value at
the right side; something like:
SELECT DISTINCT t1.table_id
FROM mytable t1 LEFT JOIN mytable t2 on (t2.table_id = t1.table_id AND
t2.username <> 'john')
WHERE (t1.username = 'john')
And t2.table_id is Null
Sylvain Lafontaine, ing.
MVP - Technologies Virtual-PC
E-mail: http://cerbermail.com/?QugbLEWINF
"phils" <jlee@.transfuture.net> wrote in message
news:1149545664.941792.259700@.h76g2000cwa.googlegroups.com...
> Is it possible to convert the following query to use ANSI join syntax?
> It may be already but I'm suspecting the "WHERE t2.table_id =
> t1.table_id" means it isn't. I tried things like the bottom query but
> the number of records returned doesn't match. Any help would be
> appreciated. I can't give the DDL or test date cause this is a
> simplification of the actual query. Thanks a lot!
> SELECT DISTINCT t1.table_id
> FROM mytable t1
> WHERE (t1.username = 'john')
> AND (NOT EXISTS (SELECT * FROM mytable t2 WHERE t2.table_id =
> t1.table_id AND t2.username <> 'john'))
>
> -- my attempt --
> SELECT DISTINCT t1.table_id
> FROM mytable t1
> INNER JOIN mytable t2 ON t2.table_id = t1.table_id AND t2.username =
> 'john'
> WHERE (t1.username = 'john')
>|||Thank you Sylvain I will try that.
Phil|||It works! Thank you Sylvain !!!|||The advantage of the LEFT JOIN is that on many occasions it will be faster
then the use of an Exists statement (not sure if it's still true but it was
some years ago).
However, it's much more easier to write some complex filterings with an
Exists() function than with the LEFT JOIN.
Sylvain Lafontaine, ing.
MVP - Technologies Virtual-PC
E-mail: http://cerbermail.com/?QugbLEWINF
"phils" <jlee@.transfuture.net> wrote in message
news:1149603901.621194.200240@.h76g2000cwa.googlegroups.com...
> It works! Thank you Sylvain !!!
>
Tuesday, February 14, 2012
Converting String -> UniqueIdentifier
I get the following error when I do a CONVERT(UNIQUEIDENTIFIER, 'guid'), where 'guid' is a properly formatted GUID created in VS2005, inside my INSERT statement:
The data was truncated while converting from one data type to another. [ Name of function(if known) = ]
The column I am inserting into has a datatype of uniqueIdentifier.
This is the query I am running:
INSERT INTO [Table] ([guid], [value1], [value2])
VALUES (CONVERT(UNIQUEIDENTIFIER, 'F067FE20-EC76-44C8-9859-FEF222FBC96D'), 'Test, 'Test')
What am I doing wrong?
Matt
This works fine:
Code Snippet
INSERT INTO [Guidtest] ([Field1], [Field2])
VALUES (1, 'F067FE20-EC76-44C8-9859-FEF222FBC96D')
So no need to CONVERT!|||
Thks~
Converting String -> UniqueIdentifier
I get the following error when I do a CONVERT(UNIQUEIDENTIFIER, 'guid'), where 'guid' is a properly formatted GUID created in VS2005, inside my INSERT statement:
The data was truncated while converting from one data type to another. [ Name of function(if known) = ]
The column I am inserting into has a datatype of uniqueIdentifier.
This is the query I am running:
INSERT INTO [Table] ([guid], [value1], [value2])
VALUES (CONVERT(UNIQUEIDENTIFIER, 'F067FE20-EC76-44C8-9859-FEF222FBC96D'), 'Test, 'Test')
What am I doing wrong?
Matt
This works fine:
Code Snippet
INSERT INTO [Guidtest] ([Field1], [Field2])
VALUES (1, 'F067FE20-EC76-44C8-9859-FEF222FBC96D')
So no need to CONVERT!|||
Thks~
Converting SQL Server Data into XML
I have the following sql script I wrote using Explicit Option to convert data from SQL Server tables into a single XML file. I am aware of the tedious nature of the select statements, but this seems to the only option I have to depict parent-child nature of the data in XML format and also to schedule it as a job to run via SQL Server Agent.
My problem is that as I run this using the following command, I get "There is insufficient system memory to run this query" error.
I am using the following commnd:
exec master..xp_cmdshell 'bcp "EXEC swr_cv2..sproc_BuildXMLTree" queryout "C:\test.xml" -U -P -c -r -t'
Is there any way I can tune my query to fix that error?
Thanks so much for your help!
-ParulHi Folks!
I am aware of the tedious nature of the select statements,
-Parul
Really tedious Parul,For the first time I am seeing so big a proc... rather a Mamoth ;)|||I know, that's because the XML feed layout is huge as well...is there a way to tune a FOR XML EXPLICIT query?|||I know, that's because the XML feed layout is huge as well...is there a way to tune a FOR XML EXPLICIT query?
You can increase the max server memory,but I am not sure whether that will help you...check this (http://sqljunkies.com/PrintContent.aspx?type=tutorial&id=0D4FF40A-695C-4327-A41B-F9F2FE2D58F6)|||Thanks! I am really hoping not to tamper with the server settings as it is a production database. I am hoping I can may be build a temp table around this data, any ideas?|||Thanks! I am really hoping not to tamper with the server settings as it is a production database. I am hoping I can may be build a temp table around this data, any ideas?
have you tried XPath queries in this case ?|||No, I am not sure if I can write XPath Queries and schedule them via SQL Server Agent. Do you know if that is possible? Or do I need a .net application for it?|||No, I am not sure if I can write XPath Queries and schedule them via SQL Server Agent. Do you know if that is possible? Or do I need a .net application for it?
check this (http://www.aspfree.com/c/a/MS-SQL-Server/XML-and-the-SQL-2000-Server-part-3-XML-Data-with-XPath-Queries/1/) ...|||Thanks! This seems helpful in generating an XML layout; however, I am still wondering how I can schedule this to run daily...|||Thanks! This seems helpful in generating an XML layout; however, I am still wondering how I can schedule this to run daily...
An easy option can be Altova xmlspy 2006.
Try this www.altova.com (http://www.altova.com) and download XMLSPY 2006|||Thanks! BTW, I got my sql query to work! I replaced all the unions with inserts - now I am inserting all the data into an actual physical data, and then running FOR XML EXPLICIT on it. It seems to be working fine now!
I had a question though - do you know if there is a sql command to merge two files. Basically, I want to merge the header for the xml file with actual xml data in another file - is that possible without running any DOS commands?
Thanks so much!