Showing posts with label provide. Show all posts
Showing posts with label provide. Show all posts

Saturday, February 25, 2012

copy a file with xp_cmdshell

hi friends,
how to move a file from client to server through xp_cmdshell
please provide the script
thanks
reddy
What exactly is it that you have a problem with? Just use cp_cmdshell and execute the desired copy
command, where you specify the paths to the files using UNC naming, like:
EXEC master..xp_cmdshell 'COPY \\machine1\sharename\filename.txt \\machine2\sharename\filename.txt'
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"reddy" <reddy@.discussions.microsoft.com> wrote in message
news:7D3AFFFE-C388-4B3A-929A-211B5DD5A419@.microsoft.com...
> hi friends,
> how to move a file from client to server through xp_cmdshell
> please provide the script
> thanks
> reddy
|||hi tibor,
i used the same command.
the error is Logon failure: unknown user name or bad password.
please help
thanks
reddy
|||hi tibor,
i used the same command.
the error is Logon failure: unknown user name or bad password.
please help
thanks
reddy
|||If copying to/from a remote drive, check that your SQL Server service is
started using a domain user account, not the Local System account, and
ensure that the right permissions are granted to this domain user to access
that remote drive.
You can check this by running the dir command from within xp_cmdshell e.g.
xp_cmdshell 'dir \\network share name'
Peter Yeoh
http://www.yohz.com
Need smaller SQL2K backups? Try MiniSQLBackup
"reddy" <reddy@.discussions.microsoft.com> wrote in message
news:14F3F85F-691A-4CD4-BA21-352F2176104A@.microsoft.com...
> hi tibor,
> i used the same command.
> the error is Logon failure: unknown user name or bad password.
> please help
> thanks
> reddy
>
|||If copying to/from a remote drive, check that your SQL Server service is
started using a domain user account, not the Local System account, and
ensure that the right permissions are granted to this domain user to access
that remote drive.
You can check this by running the dir command from within xp_cmdshell e.g.
xp_cmdshell 'dir \\network share name'
Peter Yeoh
http://www.yohz.com
Need smaller SQL2K backups? Try MiniSQLBackup
"reddy" <reddy@.discussions.microsoft.com> wrote in message
news:14F3F85F-691A-4CD4-BA21-352F2176104A@.microsoft.com...
> hi tibor,
> i used the same command.
> the error is Logon failure: unknown user name or bad password.
> please help
> thanks
> reddy
>
|||hi friends,
i tried all your suggestions.but not working for me.
i am getting the follwing errors
if i use copy
EXEC master..xp_cmdshell 'xcopy \\e-060\c\updates.txt d\upd.txt'
Invalid drive specification
if i use xcopy
EXEC master..xp_cmdshell 'xcopy \\e-060\c\updates.txt d\upd.txt'
Logon failure: unknown user name or bad password.
plase suggest if any otherways are there to copy the files
thanks®ards
reddy
|||hi friends,
i tried all your suggestions.but not working for me.
i am getting the follwing errors
if i use copy
EXEC master..xp_cmdshell 'xcopy \\e-060\c\updates.txt d\upd.txt'
Invalid drive specification
if i use xcopy
EXEC master..xp_cmdshell 'xcopy \\e-060\c\updates.txt d\upd.txt'
Logon failure: unknown user name or bad password.
plase suggest if any otherways are there to copy the files
thanks®ards
reddy
|||Check your SQL Server service account (go to Administrative Tools /
Services). Is it started using the Local System account? If it is, use a
domain user account instead.
Peter Yeoh
http://www.yohz.com
Need smaller SQL2K backups? Try MiniSQLBackup
"reddy" <reddy@.discussions.microsoft.com> wrote in message
news:1F112BD9-1970-4144-B6B0-994881CF46C9@.microsoft.com...
> hi friends,
> i tried all your suggestions.but not working for me.
> i am getting the follwing errors
> if i use copy
> EXEC master..xp_cmdshell 'xcopy \\e-060\c\updates.txt d\upd.txt'
> Invalid drive specification
> if i use xcopy
> EXEC master..xp_cmdshell 'xcopy \\e-060\c\updates.txt d\upd.txt'
> Logon failure: unknown user name or bad password.
> plase suggest if any otherways are there to copy the files
> thanks®ards
> reddy
>
|||Check your SQL Server service account (go to Administrative Tools /
Services). Is it started using the Local System account? If it is, use a
domain user account instead.
Peter Yeoh
http://www.yohz.com
Need smaller SQL2K backups? Try MiniSQLBackup
"reddy" <reddy@.discussions.microsoft.com> wrote in message
news:1F112BD9-1970-4144-B6B0-994881CF46C9@.microsoft.com...
> hi friends,
> i tried all your suggestions.but not working for me.
> i am getting the follwing errors
> if i use copy
> EXEC master..xp_cmdshell 'xcopy \\e-060\c\updates.txt d\upd.txt'
> Invalid drive specification
> if i use xcopy
> EXEC master..xp_cmdshell 'xcopy \\e-060\c\updates.txt d\upd.txt'
> Logon failure: unknown user name or bad password.
> plase suggest if any otherways are there to copy the files
> thanks®ards
> reddy
>

copy a file with xp_cmdshell

hi friends,
how to move a file from client to server through xp_cmdshell
please provide the script
thanks
reddyWhat exactly is it that you have a problem with? Just use cp_cmdshell and ex
ecute the desired copy
command, where you specify the paths to the files using UNC naming, like:
EXEC master..xp_cmdshell 'COPY \\machine1\sharename\filename.txt \\machine2\
sharename\filename.txt'
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"reddy" <reddy@.discussions.microsoft.com> wrote in message
news:7D3AFFFE-C388-4B3A-929A-211B5DD5A419@.microsoft.com...
> hi friends,
> how to move a file from client to server through xp_cmdshell
> please provide the script
> thanks
> reddy|||hi tibor,
i used the same command.
the error is Logon failure: unknown user name or bad password.
please help
thanks
reddy|||If copying to/from a remote drive, check that your SQL Server service is
started using a domain user account, not the Local System account, and
ensure that the right permissions are granted to this domain user to access
that remote drive.
You can check this by running the dir command from within xp_cmdshell e.g.
xp_cmdshell 'dir \\network share name'
Peter Yeoh
http://www.yohz.com
Need smaller SQL2K backups? Try MiniSQLBackup
"reddy" <reddy@.discussions.microsoft.com> wrote in message
news:14F3F85F-691A-4CD4-BA21-352F2176104A@.microsoft.com...
> hi tibor,
> i used the same command.
> the error is Logon failure: unknown user name or bad password.
> please help
> thanks
> reddy
>|||hi friends,
i tried all your suggestions.but not working for me.
i am getting the follwing errors
if i use copy
EXEC master..xp_cmdshell 'xcopy \\e-060\c\updates.txt d\upd.txt'
Invalid drive specification
if i use xcopy
EXEC master..xp_cmdshell 'xcopy \\e-060\c\updates.txt d\upd.txt'
Logon failure: unknown user name or bad password.
plase suggest if any otherways are there to copy the files
thanks®ards
reddy|||Check your SQL Server service account (go to Administrative Tools /
Services). Is it started using the Local System account? If it is, use a
domain user account instead.
Peter Yeoh
http://www.yohz.com
Need smaller SQL2K backups? Try MiniSQLBackup
"reddy" <reddy@.discussions.microsoft.com> wrote in message
news:1F112BD9-1970-4144-B6B0-994881CF46C9@.microsoft.com...
> hi friends,
> i tried all your suggestions.but not working for me.
> i am getting the follwing errors
> if i use copy
> EXEC master..xp_cmdshell 'xcopy \\e-060\c\updates.txt d\upd.txt'
> Invalid drive specification
> if i use xcopy
> EXEC master..xp_cmdshell 'xcopy \\e-060\c\updates.txt d\upd.txt'
> Logon failure: unknown user name or bad password.
> plase suggest if any otherways are there to copy the files
> thanks®ards
> reddy
>|||If this is a cut-n-paste of the actual code then it looks like you are
missing a ":" colon after the d in d\upd.txt
Should that read d:\upd.txt ' If not then it is a relative path are you
really sure it is there? I assume it is missing the colon based on the
error you received "Invalid drive specification"
"reddy" <reddy@.discussions.microsoft.com> wrote in message
news:1F112BD9-1970-4144-B6B0-994881CF46C9@.microsoft.com...
> hi friends,
> i tried all your suggestions.but not working for me.
> i am getting the follwing errors
> if i use copy
> EXEC master..xp_cmdshell 'xcopy \\e-060\c\updates.txt d\upd.txt'
> Invalid drive specification
> if i use xcopy
> EXEC master..xp_cmdshell 'xcopy \\e-060\c\updates.txt d\upd.txt'
> Logon failure: unknown user name or bad password.
> plase suggest if any otherways are there to copy the files
> thanks®ards
> reddy
>

Tuesday, February 14, 2012

Converting Text to number

Hello there
I have table with field which is a text field that provide numbers and text
I would like to drop all the records that on the current field has text and
leave only the records with the number on the field
For this i've tried to use the convertion process but it gave me an error
when the data is text
Is there a way to know if the data is text or number so i can deal with it?
any help would be useful
roy@.atidsm.co.il
' 050-7709399"Roy Goldhammer" <roygoldh@.hotmail.com> wrote in
news:#Ok5SqLIFHA.2564@.tk2msftngp13.phx.gbl:

> Hello there
> I have table with field which is a text field that provide numbers and
> text
> I would like to drop all the records that on the current field has text
> and leave only the records with the number on the field
> For this i've tried to use the convertion process but it gave me an
> error when the data is text
> Is there a way to know if the data is text or number so i can deal with
> it?
Try ISNUMERIC(expression)|||Although ISNUMERIC will provide the desired results in many cases, it will
also consider some obscure numeric values to be numeric. You can use LIKE
to test for integer digits. The example shows some differences between
ISNUMERIC and LIKE.
CREATE TABLE MyTable
(
MyNumber varchar(10)
)
GO
INSERT INTO MyTable VALUES('')
INSERT INTO MyTable VALUES(' ')
INSERT INTO MyTable VALUES('1')
INSERT INTO MyTable VALUES(' 2')
INSERT INTO MyTable VALUES('3 ')
INSERT INTO MyTable VALUES('1D')
INSERT INTO MyTable VALUES('0D1')
INSERT INTO MyTable VALUES('0E1')
SELECT *
FROM MyTable
WHERE ISNUMERIC(MyNumber) = 0
SELECT *
FROM MyTable
WHERE MyNumber LIKE '%[^0-9]%' OR
DATALENGTH(MyNumber) = 0
Hope this helps.
Dan Guzman
SQL Server MVP
"Roy Goldhammer" <roygoldh@.hotmail.com> wrote in message
news:%23Ok5SqLIFHA.2564@.tk2msftngp13.phx.gbl...
> Hello there
> I have table with field which is a text field that provide numbers and
> text
> I would like to drop all the records that on the current field has text
> and
> leave only the records with the number on the field
> For this i've tried to use the convertion process but it gave me an error
> when the data is text
> Is there a way to know if the data is text or number so i can deal with
> it?
> any help would be useful
> --
>
> roy@.atidsm.co.il
> ' 050-7709399
>|||ISNUMERIC also interprets '.', '-' and '+' as numeric.
Dan Guzman wrote:
> Although ISNUMERIC will provide the desired results in many cases, it
> will also consider some obscure numeric values to be numeric. You
> can use LIKE to test for integer digits. The example shows some
> differences between ISNUMERIC and LIKE.
> CREATE TABLE MyTable
> (
> MyNumber varchar(10)
> )
> GO
> INSERT INTO MyTable VALUES('')
> INSERT INTO MyTable VALUES(' ')
> INSERT INTO MyTable VALUES('1')
> INSERT INTO MyTable VALUES(' 2')
> INSERT INTO MyTable VALUES('3 ')
> INSERT INTO MyTable VALUES('1D')
> INSERT INTO MyTable VALUES('0D1')
> INSERT INTO MyTable VALUES('0E1')
> SELECT *
> FROM MyTable
> WHERE ISNUMERIC(MyNumber) = 0
> SELECT *
> FROM MyTable
> WHERE MyNumber LIKE '%[^0-9]%' OR
> DATALENGTH(MyNumber) = 0
>
> "Roy Goldhammer" <roygoldh@.hotmail.com> wrote in message
> news:%23Ok5SqLIFHA.2564@.tk2msftngp13.phx.gbl...

Sunday, February 12, 2012

Converting Oracle Encode Function into T-SQL syntax

I am looking for the correct syntax to convert Oracle encode function into T-SQl syntax. Please provide specific syntax and examples.
Thank you.Don't you mean 'decode' function?|||did you see my reply on this thread (http://dbforums.com/showthread.php?s=&threadid=444782) ?

rudy