Showing posts with label line. Show all posts
Showing posts with label line. Show all posts

Monday, March 26, 2012

MS SQL Server client under linux/unix.

Hi, everyone!
I was just wondering if any of you knows of a linux/unix client
(preferably on the command line) that would connect to ms sql server?
Any hints would be appreciated!
Roumen.http://www.sommarskog.se/mssqlperl/unix.html

--
David Portas
SQL Server MVP
--sql

Wednesday, March 21, 2012

MS SQL Server 2000... Error backing up database

Hi

I am getting an error while backing up a particular database named "asset" . The error says ......

Server: Msg 3132, Level 16, State 1, Line 4
The media set for database 'Asset' has 2 family members but only 1 are provided. All members must be provided.
Server: Msg 3013, Level 16, State 1, Line 4
BACKUP DATABASE is terminating abnormally.

I have created two backup devices for this database ("asset") through enterprise manager.
AssetDMP
AssetLogDMP

I have total 9 databases out of which only this database throws error. All other database backups going fine.

Here is the query that I am using to backup the database and Log.

USE master
GO
IF EXISTS (SELECT * FROM sysdatabases WHERE name = 'Asset')
BACKUP DATABASE Asset TO AssetDMP WITH NOUNLOAD, STATS=10, INIT, SKIP
GO
IF EXISTS (SELECT * FROM sysdatabases WHERE name = 'Asset')
BACKUP LOG Asset TO AssetLogDMP WITH NOUNLOAD, STATS=10, INIT, SKIP

Please Help

Thank You / SsgThis error occurs if a member of the stripe set (the backup was performed to more than 1 backup file/device) that was originally used to create the backup, was not selected when you tried to perform the restore. The number that displays in the message shows the set or file number that is missing.

You need to provide all the backup devices, files in your restore command|||Originally posted by Satya
This error occurs if a member of the stripe set (the backup was performed to more than 1 backup file/device) that was originally used to create the backup, was not selected when you tried to perform the restore. The number that displays in the message shows the set or file number that is missing.

You need to provide all the backup devices, files in your restore command

Dear Satya,

Thanks a lot for your quick response. This issue has been resolved by re creating the devices ; but somehow I could not understand the root cause of the problem ;). Anyway, I wanted to ask one more question here...

I am using MS SQL 2000 Server. Can I move the dabases ( Master, Model , MSDB and tempdb) to a different drive location without re-installing SQL Server !!!

Waiting for an early reply...

Thanks again,
Ssg|||Here you go with this KBA (http://support.microsoft.com/default.aspx?scid=kb;EN-US;224071) .|||BTW where abouts you're in Bangalore??|||Originally posted by Satya
BTW where abouts you're in Bangalore??

Thanks Satya,

My Question has been answered. Great help !!!

I am in ShanthiNagar , Bangalore -27

R U Familiar with BLR ?? I mean r u a bangalorean ?

Tks / Ssg|||Glad this works... I sent you private message as its ideal for personal chat.|||Originally posted by Satya
Glad this works... I sent you private message as its ideal for personal chat.

satya,

I don't find any private mesg.. It shows empty..however you can mail me.

Thanks
Ssg|||My PM tracking confirms an email sent to you about this Private message, check the email when you registered to this site.

Monday, March 12, 2012

MS SQL Linked Server Issue

Hi All,
I am have created a linked server in MS SQL 2000 to Sage Line 50v12 using the ODBC drivers in sage.I am able to view all the tables once I clicked on the link server link in the SQL enterprise manager. However when I run the below query I get only one records instead of 28.
SELECT * FROM OPENQUERY(SageL50, 'SELECT * from Sales_Ledger')
I am running SQL 2000 server with SP4
From the SQL online documentation I got to know that OPENQUERY returns only a single record. Is there any other function/command that will enable me to get all the records from a table from a linked server?
Can you let me know I am missing here?
Thanks and Regards,
Saurabh
Hi,
Any updates on the below query.
Thanks and Regards,
Saurabh
"news" <news@.microsoft.com> wrote in message news:%23b2csSXbIHA.484@.TK2MSFTNGP06.phx.gbl...
Hi All,
I am have created a linked server in MS SQL 2000 to Sage Line 50v12 using the ODBC drivers in sage.I am able to view all the tables once I clicked on the link server link in the SQL enterprise manager. However when I run the below query I get only one records instead of 28.
SELECT * FROM OPENQUERY(SageL50, 'SELECT * from Sales_Ledger')
I am running SQL 2000 server with SP4
From the SQL online documentation I got to know that OPENQUERY returns only a single record. Is there any other function/command that will enable me to get all the records from a table from a linked server?
Can you let me know I am missing here?
Thanks and Regards,
Saurabh
|||Did you try:
SELECT * FROM SageL50.<database>.<owner/schema>.Sales_Ledger
Replace <database> with the database that contains the table you want,
and the <owner/schema> with the owner of the table - generally dbo.
Example:
SELECT * FROM SageL50.db1.dbo.SalesLedger;
Jeff
news wrote:
> Hi,
> Any updates on the below query.
> Thanks and Regards,
> Saurabh
>
> "news" <news@.microsoft.com <mailto:news@.microsoft.com>> wrote in
> message news:%23b2csSXbIHA.484@.TK2MSFTNGP06.phx.gbl...
> Hi All,
> I am have created a linked server in MS SQL 2000 to Sage Line
> 50v12 using the ODBC drivers in sage.I am able to view all the
> tables once I clicked on the link server link in the SQL
> enterprise manager. However when I run the below query I get only
> one records instead of 28.
> SELECT * FROM OPENQUERY(SageL50, 'SELECT * from Sales_Ledger')
> I am running SQL 2000 server with SP4
> From the SQL online documentation I got to know that OPENQUERY
> returns only a single record. Is there any other function/command
> that will enable me to get all the records from a table from a
> linked server?
> Can you let me know I am missing here?
> Thanks and Regards,
> Saurabh
>

ms sql dts package

I created a DTS package, which has a vbscript file to create a new directory, when i run it directly from the command line “DOS” C:\>dtsrun /Sxxxxxxxx /u!xxxx /pxxxxxx /NZOOT_NDM_COPY_and_ZIP_SCORECARD

, I get:
DTSRun: Loading...
DTSRun: Executing...
DTSRun OnStart: DTSStep_DTSActiveScriptTask_3
DTSRun OnFinish: DTSStep_DTSActiveScriptTask_3
DTSRun OnStart: DTSStep_DTSActiveScriptTask_1
DTSRun OnFinish: DTSStep_DTSActiveScriptTask_1
DTSRun OnStart: DTSStep_DTSActiveScriptTask_2
DTSRun OnError: DTSStep_DTSActiveScriptTask_2, Error = -2147220482 (800403FE)
Error string: Error Code: 0
Error Source= Microsoft VBScript runtime error
Error Description: Path not found
Error on Line 12
Error source: Microsoft Data Transformation Services (DTS) Package
Help file: sqldts80.hlp
Help context: 4500
Error Detail Records:
Error: -2147220482 (800403FE); Provider Error: 0 (0)
Error string: Error Code: 0
Error Source= Microsoft VBScript runtime error
Error Description: Path not found
Error on Line 12
Error source: Microsoft Data Transformation Services (DTS) Package
Help file: sqldts80.hlp
Help context: 4500
DTSRun OnFinish: DTSStep_DTSActiveScriptTask_2
Error: -2147220440 (80040428); Provider Error: 0 (0)
Error string: Package failed because Step 'DTSStep_DTSActiveScriptTask_2' failed.
Error source: Microsoft Data Transformation Services (DTS) Package
Help file: sqldts80.hlp
Help context: 700

'************************************************* *********************
' Visual Basic ActiveX Script
'************************************************* ***********************
Function Main()
Dim fso,f1,f8,s,fldr,drv,fc,f
Set fso = CreateObject("Scripting.FileSystemObject")
f8 = DTSGlobalVariables("DATA_PATH").Value
' CREATE TODAYS FOLDER
if fso.FolderExists(f8&"\ZOOT_"&FormatDateTime(now,VBSHORTDATE)) then = LINE 12
'msgbox "directory Exists"
else
fso.CreateFolder (f8&"\ZOOT_"&FormatDateTime(now,VBSHORTDATE))
end if
' LOOP Through Files
'Change to a variable
Set f = fso.GetFolder(f8)
Set fc = f.Files
For Each f1 in fc
if cdate(left(f1.DateLastModified,10)) = cdate(datevalue(NOW)) then
f1.move (f8& "\ZOOT_"&FormatDateTime(now,VBSHORTDATE) &"\"&f1.name)
end if
' msgbox f1.name
Next
Main = DTSTaskExecResult_Success
End FunctionPlease verify the following:

Have you created a DTS from you EM Client or directly on the server ?

If this is the scenario then it gives you error. Instead of specifying the path like "c:\foldername\" try to give the UNC e.g \\servername\foldername"

May be it will help you

Thanks|||And ensure login used to execute the package has required privilege to complete the task or if you've scheduled same for the SQLAgent service account.

Friday, March 9, 2012

MS SQL Command line insert

I use a similar command below to insert into a temp table the result of a large command line call to an exectable with many parameters passed in the command of which the result passed back contains many items. I then parse the response string to get my results...

set @.command = 'dir'
insert into tsverisign(response) exec master..xp_cmdshell @.command

My question is our can I insert two values at the same time to this same table one of which is my "exec master..xp_cmdshell @.command"

similar to insert into tables (field_a, feild_b) values ('1','2')

Something like (and I know this does not work):

insert into tsverisign(response,trans_id)
values (exec master..xp_cmdshell @.command, '123')

Any help would be greatly appreciated ... PS I'm new to MS SQL 2000 and proper syntax etc. etc. so I need full example so I can try. :rolleyes:What you're trying to do is not possible (in any dbms). What you should do is to dump the result of @.command into a staging table. Then insert it into the target table.

e.g.
insert into staging(i)
exec master..xp_cmdshell @.command

insert into target(i,j)
select i, @.other_val
from staging