Showing posts with label tsql. Show all posts
Showing posts with label tsql. Show all posts

Monday, March 26, 2012

Job Sequencing ?

I have a job that runs a batch file, tsql step, and then another batch file.
My question is will the agent say the first step is complete and move on
when it starts the batch file or will it know to wait until after the batch
has ran to start the second step?
TIA
--
nivekHi
It waits for the prior step to finish.
Regards
--
Mike Epprecht, Microsoft SQL Server MVP
Zurich, Switzerland
IM: mike@.epprecht.net
MVP Program: http://www.microsoft.com/mvp
Blog: http://www.msmvps.com/epprecht/
"nivek" <eckart_612@.hotmail.com> wrote in message
news:36GdnYIXz77QzN3fRVn-3A@.centurytel.net...
> I have a job that runs a batch file, tsql step, and then another batch
file.
> My question is will the agent say the first step is complete and move on
> when it starts the batch file or will it know to wait until after the
batch
> has ran to start the second step?
> TIA
> --
> nivek
>
>
>

Job Sequencing ?

I have a job that runs a batch file, tsql step, and then another batch file.
My question is will the agent say the first step is complete and move on
when it starts the batch file or will it know to wait until after the batch
has ran to start the second step?
TIA
nivekHi
It waits for the prior step to finish.
Regards
--
Mike Epprecht, Microsoft SQL Server MVP
Zurich, Switzerland
IM: mike@.epprecht.net
MVP Program: http://www.microsoft.com/mvp
Blog: http://www.msmvps.com/epprecht/
"nivek" <eckart_612@.hotmail.com> wrote in message
news:36GdnYIXz77QzN3fRVn-3A@.centurytel.net...
> I have a job that runs a batch file, tsql step, and then another batch
file.
> My question is will the agent say the first step is complete and move on
> when it starts the batch file or will it know to wait until after the
batch
> has ran to start the second step?
> TIA
> --
> nivek
>
>
>

Job Sequencing ?

I have a job that runs a batch file, tsql step, and then another batch file.
My question is will the agent say the first step is complete and move on
when it starts the batch file or will it know to wait until after the batch
has ran to start the second step?
TIA
nivek
Hi
It waits for the prior step to finish.
Regards
Mike Epprecht, Microsoft SQL Server MVP
Zurich, Switzerland
IM: mike@.epprecht.net
MVP Program: http://www.microsoft.com/mvp
Blog: http://www.msmvps.com/epprecht/
"nivek" <eckart_612@.hotmail.com> wrote in message
news:36GdnYIXz77QzN3fRVn-3A@.centurytel.net...
> I have a job that runs a batch file, tsql step, and then another batch
file.
> My question is will the agent say the first step is complete and move on
> when it starts the batch file or will it know to wait until after the
batch
> has ran to start the second step?
> TIA
> --
> nivek
>
>
>
sql

Monday, March 19, 2012

Job Hang

Hi,

I am running the following TSQL command and it hangs. These commands are running from SQL 2000 server and it is querying information for SQL20005 database.

Running simple EXEC command work fine but running using Insert hangs.

Set @.Cmd = @.ServerName + '.' + @.dbname + '.dbo.sp_helpntgroup'
Print @.Cmd
Insert into dbo.DBSecurity ( NTGroupName, NTGroupID, SID, HasDbAccess)
Exec (@.Cmd)

Any idea,

Is the SQL Server 2005 server configured as a linked server or remote server?

If the SQL Server 2005 server is configured as a remote server and SET REMOTE_PROC_TRANSACTIONS is ON/the option is set then the insert...exec will start a distributed transaction automatically. So depending on your network configuration and setup you might be incurring delays there. See BOL for more details on this.

If the SQL Server 2005 server is configured as linked server then the REMOTE_PROC_TRANSACTIONS setting doesn't apply but insert...exec will always start a distribured transaction.

First, you can look for the wait type when the insert..exec statement hangs by querying sysprocesses. Search for the MSKB article that documents how to use this information. Finding the waittype will help you identify the source of the problem - network related, SQL Server or IO etc. If it is network related then can you please check the MSDTC configuration. You can also use the MSDTC console from Administrative Tools\Component Services (will differ based on OS but this is for Windows Server 2003) to see the transaction statisitics/configuration of MSDTC.

|||

SQL Server 2005 is configured as Linked Server in SQL 2000. last wait type is OLEDB
Component Services saying 1 Active transaction and 1 aborted.

Thanks

Shafiq

Job Hang

Hi,

I am running the following TSQL command and it hangs. These commands are running from SQL 2000 server and it is querying information for SQL20005 database.

Running simple EXEC command work fine but running using Insert hangs.

Set @.Cmd = @.ServerName + '.' + @.dbname + '.dbo.sp_helpntgroup'
Print @.Cmd
Insert into dbo.DBSecurity ( NTGroupName, NTGroupID, SID, HasDbAccess)
Exec (@.Cmd)

Any idea,

Is the SQL Server 2005 server configured as a linked server or remote server?

If the SQL Server 2005 server is configured as a remote server and SET REMOTE_PROC_TRANSACTIONS is ON/the option is set then the insert...exec will start a distributed transaction automatically. So depending on your network configuration and setup you might be incurring delays there. See BOL for more details on this.

If the SQL Server 2005 server is configured as linked server then the REMOTE_PROC_TRANSACTIONS setting doesn't apply but insert...exec will always start a distribured transaction.

First, you can look for the wait type when the insert..exec statement hangs by querying sysprocesses. Search for the MSKB article that documents how to use this information. Finding the waittype will help you identify the source of the problem - network related, SQL Server or IO etc. If it is network related then can you please check the MSDTC configuration. You can also use the MSDTC console from Administrative Tools\Component Services (will differ based on OS but this is for Windows Server 2003) to see the transaction statisitics/configuration of MSDTC.

|||

SQL Server 2005 is configured as Linked Server in SQL 2000. last wait type is OLEDB
Component Services saying 1 Active transaction and 1 aborted.

Thanks

Shafiq

Friday, February 24, 2012

jet oledb from tsql

I have posted following question in sqlprogramming but have
not recieved a response so wondered whether I have posted
it correctly
[url]https://msdn.microsoft.com/newsgroups/managed/default.aspx?&query=OPENROWSET&lang=en&cr=US&guid= &sloc=en-us&dg=microsoft.public.sqlserver.programming&p=1&t id=1d7f7e0b-dfea-4606-ac59-dfac726d711e[/url]
Please help,
since the introduction of SQL2005 the default mode for opening access mdb
databases with Openrowset appears to be in exclusive open mode
I wish to open the database in share mode so the other (non net) ADO threads
can open the database at the same time
I only wish to open the database in read only mode
and so to use the mode param
I have tried the following
SELECT COUNT(*)
FROM
OPENROWSET ( 'Microsoft.Jet.OLEDB.4.0',
'"Database = h:\alarmlogfiles\new folder (3)\alarms 04 feb
2007.mdb; Mode = Share Deny None;"'
, 'SELECT [ID],
[System],
[Group],
[Message],
[Acknowledged],
[AckReq],
[Duplicates],
[Group Name],
[Importance],
[Ms],
[Alarm Date],
[LastDupe],
[Viewers],
[Row_Date],
[Colours],
[Status] From [Alarms 08 Feb 2007] Where 1 = 0' )
but get the following error from sql2005 & sql 2000
Server: Msg 7303, Level 16, State 1, Line 1
Cannot initialize the data source object of OLE DB provider
"Microsoft.Jet.OLEDB.4.0" for linked server "(null)".
OLE DB provider "Microsoft.Jet.OLEDB.4.0" for linked server "(null)"
returned message "Could not find installable ISAM.".
[vbcol=seagreen]
SELECT CustomerID, CompanyName
FROM OPENROWSET('Microsoft.Jet.OLEDB.4.0',
'C:\Program Files\Microsoft Office\OFFICE11\SAMPLES\Northwind.mdb';
'admin';'',Customers)
GO
but there is no opportunity here to add a open mode argument?
please help
best wishes nick
""privatenews"" wrote:

> Hello Nick,
> I understand that you 'd like to create Access database and access it from
> SQL Server via TSQL directly. If it is not correct, let me know.
> You may want to create linked server to Access database or use open
> openquery/openrowset or four-part name syntax to query access database.
> Please refer to teh following links for more informaitoin:
> http://msdn2.microsoft.com/en-us/library/ms190479.aspx
> 287414You cannot link tables into a Microsoft Access project by using an
> ODBC Data Source Name (DSN)
> http://support.microsoft.com/default.aspx?scid=kb;EN-US;287414
> As for creating database, it is not feasible to create directly from
> opendatasource etc from SQL Server. You need to use adox/ado to do this as
> you'v done.
> 317881How to create an Access database by using ADOX and Visual C# .NET
> http://support.microsoft.com/default.aspx?scid=kb;EN-US;317881
> If you have further questions, please let's know.
> Best Regards,
> Peter Yang
> MCSE2000/2003, MCSA, MCDBA
> Microsoft Online Partner Support
> When responding to posts, please "Reply to Group" via your newsreader so
> that others may learn and benefit from your issue.
> ================================================== ===
>
> This posting is provided "AS IS" with no warranties, and confers no rights.
>
>
Hello Nick,
Sorry for the late response and it seems there is sync issue in our
internal application for your account. I'v reported this issue to the
related team.
Per your question, I was able to reproduce the issue on my side. It seems
that we are not able to use provider or connection string in the
"datasource" parameter. It also doesn't work if I use provider string
directly:
SELECT CustomerID, CompanyName from
OPENROWSET('Microsoft.Jet.OLEDB.4.0',
'Data Provider=Microsoft.Jet.OLEDB.4.0;User ID=Admin;Data
Source=C:\northwind.mdb;Passord=""',
'select * from customers')
I'v forward your feedback to the product team. In the meantime, I also
encourage you submit via the link below
http://lab.msdn.microsoft.com/productfeedback/default.aspx
Please let's know if you have any further feedback.
Best Regards,
Peter Yang
MCSE2000/2003, MCSA, MCDBA
Microsoft Online Partner Support
================================================== ===
This posting is provided "AS IS" with no warranties, and confers no rights.
================================================== ====

jet oledb from tsql

I wish to create a new access database each week whos name includes the
curent date, then to create 7 tables in the database eg '27 Jul 2006.mdb' on
e
for each day
I then wish to insert rows into these tables,
currently I use managed adox & ado to do this, is it possible to use tsql to
get
sql server write the files from its oledb drivers, and would there be any
problems
doing this
in particular I do not know what arguments to pass to opendatasource to
create a new database.Hello Nick,
I understand that you 'd like to create Access database and access it from
SQL Server via TSQL directly. If it is not correct, let me know.
You may want to create linked server to Access database or use open
openquery/openrowset or four-part name syntax to query access database.
Please refer to teh following links for more informaitoin:
http://msdn2.microsoft.com/en-us/library/ms190479.aspx
287414 You cannot link tables into a Microsoft Access project by using an
ODBC Data Source Name (DSN)
http://support.microsoft.com/defaul...kb;EN-US;287414
As for creating database, it is not feasible to create directly from
opendatasource etc from SQL Server. You need to use adox/ado to do this as
you'v done.
317881 How to create an Access database by using ADOX and Visual C# .NET
http://support.microsoft.com/defaul...kb;EN-US;317881
If you have further questions, please let's know.
Best Regards,
Peter Yang
MCSE2000/2003, MCSA, MCDBA
Microsoft Online Partner Support
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
========================================
=============
This posting is provided "AS IS" with no warranties, and confers no rights.|||Hello Nick,
I understand that you 'd like to create Access database and access it from
SQL Server via TSQL directly. If it is not correct, let me know.
You may want to create linked server to Access database or use open
openquery/openrowset or four-part name syntax to query access database.
Please refer to teh following links for more informaitoin:
http://msdn2.microsoft.com/en-us/library/ms190479.aspx
287414 You cannot link tables into a Microsoft Access project by using an
ODBC Data Source Name (DSN)
http://support.microsoft.com/defaul...kb;EN-US;287414
As for creating database, it is not feasible to create directly from
opendatasource etc from SQL Server. You need to use adox/ado to do this as
you'v done.
317881 How to create an Access database by using ADOX and Visual C# .NET
http://support.microsoft.com/defaul...kb;EN-US;317881
If you have further questions, please let's know.
Best Regards,
Peter Yang
MCSE2000/2003, MCSA, MCDBA
Microsoft Online Partner Support
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
========================================
=============
This posting is provided "AS IS" with no warranties, and confers no rights.|||I have posted following question in sqlprogramming but have
not recieved a response so wondered whether I have posted
it correctly
https://msdn.microsoft.com/newsgrou...59-dfac726d711e
Please help,
since the introduction of SQL2005 the default mode for opening access mdb
databases with Openrowset appears to be in exclusive open mode
I wish to open the database in share mode so the other (non net) ADO threads
can open the database at the same time
I only wish to open the database in read only mode
and so to use the mode param
I have tried the following
SELECT COUNT(*)
FROM
OPENROWSET ( 'Microsoft.Jet.OLEDB.4.0',
'"Database = h:\alarmlogfiles\new folder (3)\alarms 04 feb
2007.mdb; Mode = Share Deny None;"'
, 'SELECT [ID],
[System],
[Group],
[Message],
[Acknowledged],
[AckReq],
[Duplicates],
[Group Name],
[Importance],
[Ms],
[Alarm Date],
[LastDupe],
[Viewers],
[Row_Date],
[Colours],
[Status] From [Alarms 08 Feb 2007] Where 1 = 0' )
but get the following error from sql2005 & sql 2000
Server: Msg 7303, Level 16, State 1, Line 1
Cannot initialize the data source object of OLE DB provider
"Microsoft.Jet.OLEDB.4.0" for linked server "(null)".
OLE DB provider "Microsoft.Jet.OLEDB.4.0" for linked server "(null)"
returned message "Could not find installable ISAM.".

SELECT CustomerID, CompanyName
FROM OPENROWSET('Microsoft.Jet.OLEDB.4.0',
'C:\Program Files\Microsoft Office\OFFICE11\SAMPLES\Northwind.mdb';
'admin';'',Customers)
GO
but there is no opportunity here to add a open mode argument?
please help
best wishes nick
""privatenews"" wrote:
[vbcol=seagreen]
> Hello Nick,
> I understand that you 'd like to create Access database and access it from
> SQL Server via TSQL directly. If it is not correct, let me know.
> You may want to create linked server to Access database or use open
> openquery/openrowset or four-part name syntax to query access database.
> Please refer to teh following links for more informaitoin:
> http://msdn2.microsoft.com/en-us/library/ms190479.aspx
> 287414 You cannot link tables into a Microsoft Access project by using an
> ODBC Data Source Name (DSN)
> http://support.microsoft.com/defaul...kb;EN-US;287414
> As for creating database, it is not feasible to create directly from
> opendatasource etc from SQL Server. You need to use adox/ado to do this as
> you'v done.
> 317881 How to create an Access database by using ADOX and Visual C# .NET
> http://support.microsoft.com/defaul...kb;EN-US;317881
> If you have further questions, please let's know.
> Best Regards,
> Peter Yang
> MCSE2000/2003, MCSA, MCDBA
> Microsoft Online Partner Support
> When responding to posts, please "Reply to Group" via your newsreader so
> that others may learn and benefit from your issue.
> ========================================
=============
>
> This posting is provided "AS IS" with no warranties, and confers no rights
.
>
>|||Hello Nick,
Sorry for the late response and it seems there is sync issue in our
internal application for your account. I'v reported this issue to the
related team.
Per your question, I was able to reproduce the issue on my side. It seems
that we are not able to use provider or connection string in the
"datasource" parameter. It also doesn't work if I use provider string
directly:
SELECT CustomerID, CompanyName from
OPENROWSET('Microsoft.Jet.OLEDB.4.0',
'Data Provider=Microsoft.Jet.OLEDB.4.0;User ID=Admin;Data
Source=C:\northwind.mdb;Passord=""',
'select * from customers')
I'v forward your feedback to the product team. In the meantime, I also
encourage you submit via the link below
http://lab.msdn.microsoft.com/produ...ck/default.aspx
Please let's know if you have any further feedback.
Best Regards,
Peter Yang
MCSE2000/2003, MCSA, MCDBA
Microsoft Online Partner Support
========================================
=============
This posting is provided "AS IS" with no warranties, and confers no rights.
========================================
==============