Showing posts with label stuck. Show all posts
Showing posts with label stuck. Show all posts

Wednesday, March 21, 2012

Help batch script task stuck in a loop

I have a .bat file that calls a script file to log in to a server and upload a file to my pub account. When I run the .bat file it just executes the command over and over and never executes the script file. Does anyone know why? Am I missing something in my script or .bat file commands below?

my .bat file contains this>ftp -s:script.txt

my script file contains this:

open myserver.com
username
password
put W:\UPLOAD\doc.txt
bye
exit

Thanks,

Mike

Looping doesn't seem reminiscent of the batch file or the script you have listed here. I sounds like it may be due to some logic in your package. Any chance this is happening in your package?|||

It works now.

|||

Mike,

I have the same problem, can you post the solution?

Thanks.

Sebastian.

|||

Instead of using the batch file, I used a ftp script and called it using the Execute Process Task Editor:

Executable: C:\WINDOWS\system32\ftp.exe

Arguments: -s:"C:\Documents and Settings\me\Desktop\SQL 2005 DMS project-Prod\Download E-Apps\ftpscript.txt"

the ftpscript.txt file contains the following:

open hostname
me
password
Ascii
put filepath\name
bye
exit

sql

Help batch script task stuck in a loop

I have a .bat file that calls a script file to log in to a server and upload a file to my pub account. When I run the .bat file it just executes the command over and over and never executes the script file. Does anyone know why? Am I missing something in my script or .bat file commands below?

my .bat file contains this>ftp -s:script.txt

my script file contains this:

open myserver.com
username
password
put W:\UPLOAD\doc.txt
bye
exit

Thanks,

Mike

Looping doesn't seem reminiscent of the batch file or the script you have listed here. I sounds like it may be due to some logic in your package. Any chance this is happening in your package?|||

It works now.

|||

Mike,

I have the same problem, can you post the solution?

Thanks.

Sebastian.

|||

Instead of using the batch file, I used a ftp script and called it using the Execute Process Task Editor:

Executable: C:\WINDOWS\system32\ftp.exe

Arguments: -s:"C:\Documents and Settings\me\Desktop\SQL 2005 DMS project-Prod\Download E-Apps\ftpscript.txt"

the ftpscript.txt file contains the following:

open hostname
me
password
Ascii
put filepath\name
bye
exit

Monday, February 27, 2012

Help - Error deleting publication or adding subscription

In the haste of trying to delete a publication/subscription combo, it looks
as if it's stuck in limbo. I must have done something out of sequence.
In Microsoft SQL Server Management Studio it appears the subscription on the
secondary server has been deleted yet I can't delete the publication as it
says it can't delete the subscription. When I try to add the subscription on
the second server it says it already exists, even though It doesn't list
itself under subscriptions.
I'm trying to remove all replication and I'm wondering if it needs to be
deleted manually through the database as something is out of sync.
Thanks
Ron
If this is a push subscription issue the following
sp_dropsubscription @.publication= 'PublicationName', @.article= 'ALL',
@.subscriber= 'SubscriberName'
, @.destination_db= 'SubscriptionDatabase', @.ignore_distributor = 0If this
does not clear it up do thissp_dropsubscription @.publication=
'PublicationName', @.article= 'ALL', @.subscriber= 'SubscriberName'
, @.destination_db= 'SubscriptionDatabase', @.ignore_distributor = 1Then
check your subscription database. See if there are entries in the tables
MSreplication_subscriptions and MSsubscription_agents for this publication
and delete the entries if they exist.-- http://www.zetainteractive.com -
Shift Happens!
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
"Ron" <Ron@.discussions.microsoft.com> wrote in message
news:AB12955C-2B1C-4C1A-9D11-7F47D8FB6A29@.microsoft.com...
> In the haste of trying to delete a publication/subscription combo, it
> looks
> as if it's stuck in limbo. I must have done something out of sequence.
> In Microsoft SQL Server Management Studio it appears the subscription on
> the
> secondary server has been deleted yet I can't delete the publication as it
> says it can't delete the subscription. When I try to add the subscription
> on
> the second server it says it already exists, even though It doesn't list
> itself under subscriptions.
> I'm trying to remove all replication and I'm wondering if it needs to be
> deleted manually through the database as something is out of sync.
> Thanks
> Ron
|||Thanks Hillary,
Before i saw your reply I executed the following and it worked:
EXEC sp_droppublication @.publication = N'xxxxxxx'
go
USE master
GO
EXEC sp_replicationdboption @.dbname = N'xxxxxxx',
@.optname = N'publish', @.value = N'false'
"Hilary Cotter" wrote:

> If this is a push subscription issue the following
> sp_dropsubscription @.publication= 'PublicationName', @.article= 'ALL',
> @.subscriber= 'SubscriberName'
> , @.destination_db= 'SubscriptionDatabase', @.ignore_distributor = 0If this
> does not clear it up do thissp_dropsubscription @.publication=
> 'PublicationName', @.article= 'ALL', @.subscriber= 'SubscriberName'
> , @.destination_db= 'SubscriptionDatabase', @.ignore_distributor = 1Then
> check your subscription database. See if there are entries in the tables
> MSreplication_subscriptions and MSsubscription_agents for this publication
> and delete the entries if they exist.-- http://www.zetainteractive.com -
> Shift Happens!
> 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
> "Ron" <Ron@.discussions.microsoft.com> wrote in message
> news:AB12955C-2B1C-4C1A-9D11-7F47D8FB6A29@.microsoft.com...
>
>

Help - Can Execute return a value?

Hello
I'm relatively new to SQL Server/T-SQL and find myself stuck with this
problem:
I need to do something like this:
Declare @.someValue NVarchar(100)
Declare @.someFunction Varchar(100)
--
-- Assign value to @.someValue from a Cursor
--
--
-- Assign name of the function to @.someFunction from a Cursor
--
Declare @.ret NVarchar(100)
Execute 'Select @.ret = ' + @.someFunc + '(''' + @.someValue + ''')'
I expect the last Execute statement to leave the return value from the
function in @.ret.
What I get is
Must declare the variable '@.ret'.
I have also tried
Execute sp_ExecuteSQL 'Select @.ret = ' + @.someFunc + '(''' +
@.someValue + ''')'
with the same result.
Any help with making this work or other ways of doing this will be very
much appreciated!
TIA.
Vamsi.Vamsi,
Use sp_executesql.
Declare @.ret NVarchar(100)
declare @.sql nvarchar(4000)
set @.sql = N'Select @.ret = ' + @.someFunc + '(''' + @.someValue + ''')'
exec sp_executesql @.sql, N'@.ret NVarchar(100) output', @.ret output
print @.ret
go
The Curse and Blessings of Dynamic SQL
http://www.sommarskog.se/dynamic_sql.html
AMB|||Splendid!!
I still can't understand that one line of code, but, it worked
perfectly :-)
Thanks very much, AMB.
V.|||tvamsidhar (tvamsidhar@.gmail.com) writes:
> Splendid!!
> I still can't understand that one line of code, but, it worked
> perfectly :-)
For more details on sp_executesql and dynamic SQL in general, see
an article on my web site: http://www.sommarskog.se/dynamic_sql.html.
By the way, if you are new to T-SQL, dynamic SQL is probably not where
you should start.
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|||Thanks Erland, I'll study the article! Its already in my Google
bookmarks :)
As for starting with dynamic SQL, I really don't have a choice :-) I
need to be able to run validations and formatting on type-less text
data that should be "interpreted" to be of datatypes defined in a
metadata repository (SQL Server tables) and satisfying validations
(reg. expressions, TSQL functions/SPs, etc) specified in the same
repository.
Running these on the app. server turned out to be way too inefficient
and cumbursome; hence the dynamic SQL. And although I'm more
experienced with PL/SQL, the powers that be insist on using SQL Server
I thank you for the input.
V.

Friday, February 24, 2012

HELP - ActiveX stuck in loop, cannot kill!

Someone please help--

I've been working on an ActiveX script in a DTS package. I executed the script and it's stuck in a while..wend loop. If I kill it I will lose all the code I wrote (pretty much a lot) since last saving the entire package.

Is it possible either:

a) Kill the activex step without killing the entire DTS designer session.
b) Locate the ActiveX code which must be in a temp table somewhere.

Please help I don't want to recode the entire object.

Thanks!If you kill the spid when eunning a query in qa it doesn't shut qa...

Now don't take my word for it, but maybe if you kill the spid, the designer session will still be open...

BUT WHY would you run something before saving and WHY would you have a loop of any kind?

Help

Hi Guys can you take a look at this SP. When I start with a fresh clean table it seems to work for a little while, But after awhile it gets stuck messed up and dosen't update correctly.

Is there a better way to write this? Thank You

Update SalesPersonelUPCNumber
SET
MoneyOwed = SalesPersonelNewCustomerSalesCount.Level1MoneyEarned +Level2MoneyEarned +Level3MoneyEarned
FROM
SalesPersonelNewCustomerSalesCount
WHERE
SalesPersonelUPCNumber.UserName IN (@.UserName)

Can you tell us what you mean by "it gets stuck messed up and dosen't update correctly"?

Are these columns SalesPersonelNewCustomerSalesCount.Level1MoneyEarned ,Level2MoneyEarned ,Level3MoneyEarned in table SalesPersonelUPCNumber?

Also modify your WHERE clause to

WHERE SalesPersonelUPCNumber.UserName = (@.UserName)

for efficient query plan.

|||

Can you tell us what you mean by "it gets stuck messed up and dosen't update correctly"? --> When I click on the Update Button It ddin't Update values stayed the same.

Are these columns SalesPersonelNewCustomerSalesCount.Level1MoneyEarned ,Level2MoneyEarned ,Level3MoneyEarned in table SalesPersonelUPCNumber? -->Yes These are Columns containing different total amounts

Want all 3 Column Values and Update at (MoneyEarned Column) at Correct UserName SalesPersonelNewCustomerSalesCount.Level1MoneyEarned +Level2MoneyEarned +Level3MoneyEarned in table SalesPersonelUPCNumber

|||

Not knowing exactly how it's table is getting messed up I would first try to rewrite the procedure to something like:

Declare @.MoneyOwed int

Select @.MoneyOwed = Level1MoneyEarned +Level2MoneyEarned +Level3MoneyEarned
FROM SalesPersonelNewCustomerSalesCount
WHERE SalesPersonelUPCNumber.UserName = @.UserName

Update SalesPersonelUPCNumber
SET MoneyOwed = @.MoneyOwned

This would make it more readable (obviously just a style choice) butmay help with the updates as well. Also, are all the Level* columns the same data type? Is it possible that any of the values in the Level columns could be NULL?

|||

Just to add to Andrew's post above, what is the db you are dealing with? SQL Server or Access?

|||

Hi Guys,

Thanks Andrew, & Dinakar for you Advice Help... Here's what seems to have have worked so far. I only had to modify it just a little bit.and add aWHERE statement. It seems to be working though. I will test it some more just to be sure.

Dinakar I'm using SQL Dbase. ThankYou Again Guys!!! Cheers!!!

Select @.MoneyOwed = Level1MoneyEarned + Level2MoneyEarned + Level3MoneyEarned
FROM SalesPersonelNewCustomerSalesCount
WHERE SalesPersonelNewCustomerSalesCount.UserName = @.UserName

Update SalesPersonelUPCNumber
SET MoneyOwed = @.MoneyOwed
WHERE
SalesPersonelUPCNumber.UserName IN (@.UserName)

|||

Use the "=" instead of IN. "=" will perform better, it will use an index seek. Also, just to be on safe side you might want to check for NULLs.

Select@.MoneyOwed=Coalesce(Level1MoneyEarned,0)+Coalesce(Level2MoneyEarned,0)+Coalesce(Level3MoneyEarned,0)

FROM SalesPersonelNewCustomerSalesCount

WHERE SalesPersonelNewCustomerSalesCount.UserName=@.UserName

Update SalesPersonelUPCNumber

SET MoneyOwed=@.MoneyOwed

WHERE SalesPersonelUPCNumber.UserName=@.UserName

|||

Andrew.Hanson:

Not knowing exactly how it's table is getting messed up I would first try to rewrite the procedure to something like:

Declare @.MoneyOwed int

Select @.MoneyOwed = Level1MoneyEarned +Level2MoneyEarned +Level3MoneyEarned
FROM SalesPersonelNewCustomerSalesCount
WHERE SalesPersonelUPCNumber.UserName = @.UserName

Update SalesPersonelUPCNumber
SET MoneyOwed = @.MoneyOwned

This would make it more readable (obviously just a style choice) butmay help with the updates as well. Also, are all the Level* columns the same data type? Is it possible that any of the values in the Level columns could be NULL?

Doing the calculation in two steps (select into holding variable and updating afterwards) is bad form. It is possible, in a multi-user system, for a transaction to be overwritten and therefore lost.

Please list the two tables and the column names in each. Please specify which columns are mandatory and which are optional (i.e., can contain a null value).

Without this information, we are all just guessing.


|||

Thanks Guys,

Seems to be working fine now, If I notice any problems with it I Post the 2 tables but for now it seems to be working. Thanks again Guys!!! Cheers