Tuesday, March 27, 2012
Extra logging in SQL error log
Hoping someone can assist with this. Is there an SQL trace flag, or
other method, where I can get the SQL server error logs (2000 and
2005) to log database detachements, and changes in DB status (eg to
read only from online etc).
I thought about a trigger on sysdatabases (sys.databases) but am
highly skeptical of triggers on system tables.
Why am I doing this? I need to monitor the up time of individual
databases on an instance, and third party tools are not an option.
thanks in advance.Hi
If you are on SQL Server 2005 you can create TRIGGER on database level (see
BOL for details)
To see error log
ms-help://MS.SQLCC.v9/MS.SQLSVR.v9.en/udb9/html/6908c21a-65e3-458f-a272-fee256d86448.htm
<snafu66@.hotmail.co.uk> wrote in message
news:1188442379.790535.109850@.m37g2000prh.googlegroups.com...
> Hi All,
> Hoping someone can assist with this. Is there an SQL trace flag, or
> other method, where I can get the SQL server error logs (2000 and
> 2005) to log database detachements, and changes in DB status (eg to
> read only from online etc).
> I thought about a trigger on sysdatabases (sys.databases) but am
> highly skeptical of triggers on system tables.
> Why am I doing this? I need to monitor the up time of individual
> databases on an instance, and third party tools are not an option.
> thanks in advance.
>
Wednesday, March 21, 2012
Extended Stored Procedures DB-Lib Alternative
sql server from an Extended Stored Procedure, has anyone built any
extended stored procedures that use other connection methods like
OLEDB? Has anyone seen links to any sample extended stored procedures
that use something other than db-lib? In particular I am interested
in something that connects back to the database as the user who
invoked the extended stored procedure. I haven't had much luck
finding any.
Also, is there an alternative for the bcp api that is a little more
current and has support for newer datatypes like bigint? We currently
use the bcp api from an extended stored procdure written in C++, but
now need to add bigint support which the bcp api doesn't have.
Thanks for any advice.You can use ODBC or OLEDB, I prefer ODBC because it is lean and mean and I
do not like COM. Both support the full set of data types including BIGINT.
ODBC contains an updated version of the BCP API since SQL Server 7.0 which
also supports all new data types or alternatively you can use the
IRowsetFastload interface if you want to use OLE DB.
There ships an ODBC sample with SQL Server, see "C:\Program Files\Microsoft
SQL Server\80\Tools\DevTools\Samples\ods\xp_odbc", there is no OLE-DB
sample.
GertD@.SQLDev.Net
Please reply only to the newsgroups.
This posting is provided "AS IS" with no warranties, and confers no rights.
You assume all risk for your use.
Copyright SQLDev.Net 1991-2004 All rights reserved.
"Bruce" <sandell@.pacbell.net> wrote in message
news:595024a5.0409171238.10aed173@.posting.google.c om...
> Since DBlib is no longer the suggested method for connecting back to
> sql server from an Extended Stored Procedure, has anyone built any
> extended stored procedures that use other connection methods like
> OLEDB? Has anyone seen links to any sample extended stored procedures
> that use something other than db-lib? In particular I am interested
> in something that connects back to the database as the user who
> invoked the extended stored procedure. I haven't had much luck
> finding any.
> Also, is there an alternative for the bcp api that is a little more
> current and has support for newer datatypes like bigint? We currently
> use the bcp api from an extended stored procdure written in C++, but
> now need to add bigint support which the bcp api doesn't have.
> Thanks for any advice.|||> Since DBlib is no longer the suggested method for connecting back to
> sql server from an Extended Stored Procedure, has anyone built any
> extended stored procedures that use other connection methods like
> OLEDB? Has anyone seen links to any sample extended stored procedures
> that use something other than db-lib? In particular I am interested
ODBC Connection works fine for the loopback in ESP's. Sample
application for the same is provided in the SQL Server Samples|||Thanks very much for the advice. I'll take a look into bcp for odbc.
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Friday, February 17, 2012
Exporting tables to another location.
In SQL-server 2005 what are the preferred method to transport tables from
one database to another database, if those databases are not connected ? (To
copy the content).
In SQL-server 2000 I used sp_generate_inserts (Copyright © 2002 Narayana
Vyas Kondreddi. All rights reserved.) a lot to export smal tables to
transport them and import them in other locations. For most situations this
does also work in SQL-server 2005.
But what if this doesn't work, because of the size (length of records or
number of records in the table), or because of datatypes. What are preferred
methods to export a database to something that can be transported (a file
which is fairly compact) and then imported in another database ?
Thanks for your time and attention,
Ben BrugmanOn May 22, 1:32 pm, "ben brugman" <b...@.niethier.nl> wrote:
> Dear reader,
> In SQL-server 2005 what are the preferred method to transport tables from
> one database to another database, if those databases are not connected ? =(To
> copy the content).
> In SQL-server 2000 I used sp_generate_inserts (Copyright =A9 2002 Narayana
> Vyas Kondreddi. All rights reserved.) a lot to export smal tables to
> transport them and import them in other locations. For most situations th=is
> does also work in SQL-server 2005.
> But what if this doesn't work, because of the size (length of records or
> number of records in the table), or because of datatypes. What are prefer=red
> methods to export a database to something that can be transported (a file
> which is fairly compact) and then imported in another database ?
> Thanks for your time and attention,
> Ben Brugman
1=2E At Source Use BCP OUT to text file with Delimiter , Zip ( If file
is huge) , Upload through FTP At Destination FTP Download, UnZIP, BCP
IN (or BULK INSERT)
2=2E use SSIS or DTS
Exporting tables to another location.
In SQL-server 2005 what are the preferred method to transport tables from
one database to another database, if those databases are not connected ? (To
copy the content).
In SQL-server 2000 I used sp_generate_inserts (Copyright 2002 Narayana
Vyas Kondreddi. All rights reserved.) a lot to export smal tables to
transport them and import them in other locations. For most situations this
does also work in SQL-server 2005.
But what if this doesn't work, because of the size (length of records or
number of records in the table), or because of datatypes. What are preferred
methods to export a database to something that can be transported (a file
which is fairly compact) and then imported in another database ?
Thanks for your time and attention,
Ben Brugman
On May 22, 1:32 pm, "ben brugman" <b...@.niethier.nl> wrote:
> Dear reader,
> In SQL-server 2005 what are the preferred method to transport tables from
> one database to another database, if those databases are not connected ? (To
> copy the content).
> In SQL-server 2000 I used sp_generate_inserts (Copyright 2002 Narayana
> Vyas Kondreddi. All rights reserved.) a lot to export smal tables to
> transport them and import them in other locations. For most situations this
> does also work in SQL-server 2005.
> But what if this doesn't work, because of the size (length of records or
> number of records in the table), or because of datatypes. What are preferred
> methods to export a database to something that can be transported (a file
> which is fairly compact) and then imported in another database ?
> Thanks for your time and attention,
> Ben Brugman
1. At Source Use BCP OUT to text file with Delimiter , Zip ( If file
is huge) , Upload through FTP At Destination FTP Download, UnZIP, BCP
IN (or BULK INSERT)
2. use SSIS or DTS
Exporting tables to another location.
In SQL-server 2005 what are the preferred method to transport tables from
one database to another database, if those databases are not connected ? (To
copy the content).
In SQL-server 2000 I used sp_generate_inserts (Copyright 2002 Narayana
Vyas Kondreddi. All rights reserved.) a lot to export smal tables to
transport them and import them in other locations. For most situations this
does also work in SQL-server 2005.
But what if this doesn't work, because of the size (length of records or
number of records in the table), or because of datatypes. What are preferred
methods to export a database to something that can be transported (a file
which is fairly compact) and then imported in another database ?
Thanks for your time and attention,
Ben BrugmanOn May 22, 1:32 pm, "ben brugman" <b...@.niethier.nl> wrote:
> Dear reader,
> In SQL-server 2005 what are the preferred method to transport tables from
> one database to another database, if those databases are not connected ? =
(To
> copy the content).
> In SQL-server 2000 I used sp_generate_inserts (Copyright =A9 2002 Narayana
> Vyas Kondreddi. All rights reserved.) a lot to export smal tables to
> transport them and import them in other locations. For most situations th=
is
> does also work in SQL-server 2005.
> But what if this doesn't work, because of the size (length of records or
> number of records in the table), or because of datatypes. What are prefer=
red
> methods to export a database to something that can be transported (a file
> which is fairly compact) and then imported in another database ?
> Thanks for your time and attention,
> Ben Brugman
1=2E At Source Use BCP OUT to text file with Delimiter , Zip ( If file
is huge) , Upload through FTP At Destination FTP Download, UnZIP, BCP
IN (or BULK INSERT)
2=2E use SSIS or DTS