Showing posts with label rows. Show all posts
Showing posts with label rows. Show all posts

Sunday, March 25, 2012

@@DBTS

Hi

There are tables in our database with timestamp column. As and when rows are updated/inserted in these tables, the timestamp column is getting populated which is getting reflected in the @.@.DBTS system variable.

However when we take the FULL database backup and restore the database, the @.@.BSTS is not showing the same timestamp value as it was when full DB backup was done (the behavior is unpredictable - once i did manage to get the correct @.@.DBTS value).

Does backup and restore process have any effects on the @.@.DBTS system variable.

Any guidance on parameter settings for Backup and restore will be appreciated to resolve this issue.

Cheers

Nishant Hate


I am assuming that is because Timestamp is a binary datatype used for row versioning, if you want the timeback you need to use datetime datatype. If you go to the Timestamp section of the link below Microsoft explains it in detail. Hope this helps.

http://msdn2.microsoft.com/en-us/library/ms191240.aspx

|||

Hi

Thanks for your prompt response.

Let me give you background on the issue

There is a source system which is already developed from which i have to take incremental data every day and load into my warehouse.

There are no datetime fields in the source system for me to use and there is no scope for us to get the source system modified,

however each table is having the timestamp column which should give me daily new/updated records in the source system.

We can acheive this by storing the last loaded Timestamp in a control table and getting the latest timestamp using @.@.DBTS

Using this range we can get the incremental data from the source system.

This works fine.

However assuming that there is some issue with the source system and the database has to be restored from the backup.

Ideally i would have liked the @.@.DBTS to have the same value that was there when the backup was taken.

But the @.@.DBTS value is not coming the same infact it moves forward.

Logically @.@.DBTS moving forward should also be fine as I am interested in the records within the range and all the records will be included in the range.

So the question now is should I rely on @.@.DBTS even though it is different from the one which was there at the time of backup.

or am i better off to aviod this because of its unpredictable nature and build something to simulate the @.@.DBTS functionality i.e. Take max(timestamp) across all tables.

Please do let me know your views.

Cheers

Nishant hate

Tuesday, March 20, 2012

::FN_VIRTUALFILESTATS doesn't work in Sql2k critical

Hi everyone,

I perfectly know that this post is bad allocated but it's a critical one. We've a cluster and there it don't get rows.

I'm trying this sentence: SELECT * FROM ::FN_VIRTUALFILESTATS and from our production server doesn't return results. Why the hell not?

However from other servers it returns data.

Thanks for your time,

Have you tried examining query execution with SQL Server Profiler?|||That's a good idea.

::fn_virtualfilestats does not return any rows

Is there any pre-requirements in order to use ::fn_virtualfilestats function.
When i ran "select * from ::fn_virtualfilestats" in SQLServer2000 returns
always 0 rows.
Need help !!!
thanks
Hi
You have to supply the DatabaseID and FileID.
e.g.
SELECT *
FROM :: fn_virtualfilestats(1, 1)
See BOL for full information.
--
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/
"jesenko k via droptable.com" <forum@.droptable.com> wrote in message
news:512B9BEB34B40@.droptable.com...
> Is there any pre-requirements in order to use ::fn_virtualfilestats
> function.
> When i ran "select * from ::fn_virtualfilestats" in SQLServer2000 returns
> always 0 rows.
> Need help !!!
> thanks
|||Or to get all the files for all the db's you can do this:
SELECT *
FROM :: fn_virtualfilestats(-1, -1)
Andrew J. Kelly SQL MVP
"Mike Epprecht (SQL MVP)" <mike@.epprecht.net> wrote in message
news:eMd3kjkhFHA.1480@.TK2MSFTNGP10.phx.gbl...
> Hi
> You have to supply the DatabaseID and FileID.
> e.g.
> SELECT *
> FROM :: fn_virtualfilestats(1, 1)
> See BOL for full information.
> --
> --
> 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/
> "jesenko k via droptable.com" <forum@.droptable.com> wrote in message
> news:512B9BEB34B40@.droptable.com...
>
|||SELECT * FROM :: fn_virtualfilestats(-1, -1)
STILL NO ROWS
Message posted via droptable.com
http://www.droptable.com/Uwe/Forums...erver/200507/1
|||Do you have SQL perfmon counters? What do you get in the last waittype
column if you select * from sysprocesses? If it always shows misc then you
blew away your counters. This can usually be fixed by restarting sql server
and ensuring NOTHING is monitoring any sql perfmon counters at the time.
This may be helpful as well:
http://www.extremeexperts.com/SQL/FA...rCounters.aspx
Andrew J. Kelly SQL MVP
"jesenko k via droptable.com" <forum@.droptable.com> wrote in message
news:512CA670C3120@.droptable.com...
> SELECT * FROM :: fn_virtualfilestats(-1, -1)
> STILL NO ROWS
>
> --
> Message posted via droptable.com
> http://www.droptable.com/Uwe/Forums...erver/200507/1
|||Probably your perf mon counters are not working.
Does select * from master.dbo.sysperfinfo return any data?
If not either your server is started with the -x option or you perfmon
counter are no longer working.
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-2005 All rights reserved.
"jesenko k via droptable.com" <forum@.droptable.com> wrote in message
news:512CA670C3120@.droptable.com...
> SELECT * FROM :: fn_virtualfilestats(-1, -1)
> STILL NO ROWS
>
> --
> Message posted via droptable.com
> http://www.droptable.com/Uwe/Forums...erver/200507/1
|||Do you have SQL perfmon counters?
I AM ORACLE GUY. I DO NOT KNOW.
What do you get in the lastwaittype column if you select * from sysprocesses?
ONLY "MISCELLANEOUS"
This can usually be fixed by restarting sql server and ensuring NOTHING is
monitoring any sql perfmon counters at the time.
ALREADY TRIED. DOES NOT WORK
http://www.extremeexperts.com/SQL/FA...rCounters.aspx
I'LL TRY THIS. LET YOU KNOW
Does select * from master.dbo.sysperfinfo return any data?
NO DATA
If not either your server is started with the -x option or you perfmon
counter are no longer working.
IT SEEMS TO ME PERFMON COUNTER DOES NOT WORK
Thanks
Message posted via droptable.com
http://www.droptable.com/Uwe/Forums...erver/200507/1
|||i made it work reloading counters
1) unlodctr MSSQLServer
2) lodctr sqlctr.ini
3) net stop mssqlserver
4) net start mssqlserver
now it works
thanks
Message posted via http://www.droptable.com

::fn_virtualfilestats does not return any rows

Is there any pre-requirements in order to use ::fn_virtualfilestats function
.
When i ran "select * from ::fn_virtualfilestats" in SQLServer2000 returns
always 0 rows.
Need help !!!
thanksHi
You have to supply the DatabaseID and FileID.
e.g.
SELECT *
FROM :: fn_virtualfilestats(1, 1)
See BOL for full information.
--
--
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/
"jesenko k via droptable.com" <forum@.droptable.com> wrote in message
news:512B9BEB34B40@.droptable.com...
> Is there any pre-requirements in order to use ::fn_virtualfilestats
> function.
> When i ran "select * from ::fn_virtualfilestats" in SQLServer2000 returns
> always 0 rows.
> Need help !!!
> thanks|||Or to get all the files for all the db's you can do this:
SELECT *
FROM :: fn_virtualfilestats(-1, -1)
Andrew J. Kelly SQL MVP
"Mike Epprecht (SQL MVP)" <mike@.epprecht.net> wrote in message
news:eMd3kjkhFHA.1480@.TK2MSFTNGP10.phx.gbl...
> Hi
> You have to supply the DatabaseID and FileID.
> e.g.
> SELECT *
> FROM :: fn_virtualfilestats(1, 1)
> See BOL for full information.
> --
> --
> 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/
> "jesenko k via droptable.com" <forum@.droptable.com> wrote in message
> news:512B9BEB34B40@.droptable.com...
>|||SELECT * FROM :: fn_virtualfilestats(-1, -1)
STILL NO ROWS
Message posted via droptable.com
http://www.droptable.com/Uwe/Forum...server/200507/1|||Do you have SQL perfmon counters? What do you get in the last waittype
column if you select * from sysprocesses? If it always shows misc then you
blew away your counters. This can usually be fixed by restarting sql server
and ensuring NOTHING is monitoring any sql perfmon counters at the time.
This may be helpful as well:
http://www.extremeexperts.com/SQL/F...erCounters.aspx
Andrew J. Kelly SQL MVP
"jesenko k via droptable.com" <forum@.droptable.com> wrote in message
news:512CA670C3120@.droptable.com...
> SELECT * FROM :: fn_virtualfilestats(-1, -1)
> STILL NO ROWS
>
> --
> Message posted via droptable.com
> http://www.droptable.com/Uwe/Forum...server/200507/1|||Probably your perf mon counters are not working.
Does select * from master.dbo.sysperfinfo return any data?
If not either your server is started with the -x option or you perfmon
counter are no longer working.
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-2005 All rights reserved.
"jesenko k via droptable.com" <forum@.droptable.com> wrote in message
news:512CA670C3120@.droptable.com...
> SELECT * FROM :: fn_virtualfilestats(-1, -1)
> STILL NO ROWS
>
> --
> Message posted via droptable.com
> http://www.droptable.com/Uwe/Forum...server/200507/1|||Do you have SQL perfmon counters?
I AM ORACLE GUY. I DO NOT KNOW.
What do you get in the lastwaittype column if you select * from sysprocesses
?
ONLY "MISCELLANEOUS"
This can usually be fixed by restarting sql server and ensuring NOTHING is
monitoring any sql perfmon counters at the time.
ALREADY TRIED. DOES NOT WORK
http://www.extremeexperts.com/SQL/F...erCounters.aspx
I'LL TRY THIS. LET YOU KNOW
Does select * from master.dbo.sysperfinfo return any data?
NO DATA
If not either your server is started with the -x option or you perfmon
counter are no longer working.
IT SEEMS TO ME PERFMON COUNTER DOES NOT WORK
Thanks
Message posted via droptable.com
http://www.droptable.com/Uwe/Forum...server/200507/1|||i made it work reloading counters
1) unlodctr MSSQLServer
2) lodctr sqlctr.ini
3) net stop mssqlserver
4) net start mssqlserver
now it works
thanks
Message posted via http://www.droptable.comsql

::fn_virtualfilestats does not return any rows

Is there any pre-requirements in order to use ::fn_virtualfilestats function.
When i ran "select * from ::fn_virtualfilestats" in SQLServer2000 returns
always 0 rows.
Need help !!!
thanksHi
You have to supply the DatabaseID and FileID.
e.g.
SELECT *
FROM :: fn_virtualfilestats(1, 1)
See BOL for full information.
--
--
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/
"jesenko k via SQLMonster.com" <forum@.SQLMonster.com> wrote in message
news:512B9BEB34B40@.SQLMonster.com...
> Is there any pre-requirements in order to use ::fn_virtualfilestats
> function.
> When i ran "select * from ::fn_virtualfilestats" in SQLServer2000 returns
> always 0 rows.
> Need help !!!
> thanks|||Or to get all the files for all the db's you can do this:
SELECT *
FROM :: fn_virtualfilestats(-1, -1)
--
Andrew J. Kelly SQL MVP
"Mike Epprecht (SQL MVP)" <mike@.epprecht.net> wrote in message
news:eMd3kjkhFHA.1480@.TK2MSFTNGP10.phx.gbl...
> Hi
> You have to supply the DatabaseID and FileID.
> e.g.
> SELECT *
> FROM :: fn_virtualfilestats(1, 1)
> See BOL for full information.
> --
> --
> 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/
> "jesenko k via SQLMonster.com" <forum@.SQLMonster.com> wrote in message
> news:512B9BEB34B40@.SQLMonster.com...
>> Is there any pre-requirements in order to use ::fn_virtualfilestats
>> function.
>> When i ran "select * from ::fn_virtualfilestats" in SQLServer2000 returns
>> always 0 rows.
>> Need help !!!
>> thanks
>|||SELECT * FROM :: fn_virtualfilestats(-1, -1)
STILL NO ROWS
Message posted via SQLMonster.com
http://www.sqlmonster.com/Uwe/Forums.aspx/sql-server/200507/1|||Do you have SQL perfmon counters? What do you get in the last waittype
column if you select * from sysprocesses? If it always shows misc then you
blew away your counters. This can usually be fixed by restarting sql server
and ensuring NOTHING is monitoring any sql perfmon counters at the time.
This may be helpful as well:
http://www.extremeexperts.com/SQL/FAQ/EnablingPerCounters.aspx
Andrew J. Kelly SQL MVP
"jesenko k via SQLMonster.com" <forum@.SQLMonster.com> wrote in message
news:512CA670C3120@.SQLMonster.com...
> SELECT * FROM :: fn_virtualfilestats(-1, -1)
> STILL NO ROWS
>
> --
> Message posted via SQLMonster.com
> http://www.sqlmonster.com/Uwe/Forums.aspx/sql-server/200507/1|||Probably your perf mon counters are not working.
Does select * from master.dbo.sysperfinfo return any data?
If not either your server is started with the -x option or you perfmon
counter are no longer working.
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-2005 All rights reserved.
"jesenko k via SQLMonster.com" <forum@.SQLMonster.com> wrote in message
news:512CA670C3120@.SQLMonster.com...
> SELECT * FROM :: fn_virtualfilestats(-1, -1)
> STILL NO ROWS
>
> --
> Message posted via SQLMonster.com
> http://www.sqlmonster.com/Uwe/Forums.aspx/sql-server/200507/1|||Do you have SQL perfmon counters?
I AM ORACLE GUY. I DO NOT KNOW.
What do you get in the lastwaittype column if you select * from sysprocesses?
ONLY "MISCELLANEOUS"
This can usually be fixed by restarting sql server and ensuring NOTHING is
monitoring any sql perfmon counters at the time.
ALREADY TRIED. DOES NOT WORK
http://www.extremeexperts.com/SQL/FAQ/EnablingPerCounters.aspx
I'LL TRY THIS. LET YOU KNOW
Does select * from master.dbo.sysperfinfo return any data?
NO DATA
If not either your server is started with the -x option or you perfmon
counter are no longer working.
IT SEEMS TO ME PERFMON COUNTER DOES NOT WORK
Thanks
Message posted via SQLMonster.com
http://www.sqlmonster.com/Uwe/Forums.aspx/sql-server/200507/1|||i made it work reloading counters
1) unlodctr MSSQLServer
2) lodctr sqlctr.ini
3) net stop mssqlserver
4) net start mssqlserver
now it works
thanks
Message posted via http://www.sqlmonster.com

Monday, March 19, 2012

.txt file to SQL Server 2005

My package inserts a text file into a database table. It first deletes the table rows, reseeds identity to 0 then inserts data from a .txt file.

Runs fine in development. When the package is run on the live server, it appears to have trouble connecting. I've checked the connection strings and they should be fine.

Error: An OLE DB error has occurred. Error code: 0x8000FFFF
Error: The AcquireConnection metod call to the connection manager "MyServer.MyDB" failed with error code 0x8000FFFF

Any suggestions?Issue resolved: it didn't occur to me until now that I needed to change the configuration Data Source to "localhost" once it was on the server!!! Works like a charm now! My first SSIS pkg installed and working, now to create a job to run it each morning...the adventure continues.

Thursday, March 8, 2012

.NET Performance - Native vs OLE DB

Using a local instance of SQL Server 2000 and .NET I have managed to insert 4000 rows across multiple tables using the OLE DB provider in 11 seconds but when using the native provider it takes 13 seconds.
I was under the impression the native provider should enhance performance not decrease it? Why is this?
Thanks, Robby
By native provider, do you mean System.Data.SqlClient? In general SqlClient
is a good deal faster than using the combination of System.Data.OleDb and
the native oledb provider for sql server. To comment further, I'd need to
know more about your scenario.
Thanks,
Dave
"Robby White" <Robby White@.discussions.microsoft.com> wrote in message
news:04E120F8-5A6E-42F9-80E9-8BBD32B887C3@.microsoft.com...
> Using a local instance of SQL Server 2000 and .NET I have managed to
insert 4000 rows across multiple tables using the OLE DB provider in 11
seconds but when using the native provider it takes 13 seconds.
> I was under the impression the native provider should enhance performance
not decrease it? Why is this?
> Thanks, Robby
|||Yes I mean the System.Data.SqlClient provider.
Inserting 4000 records into SQL Server 2000
using the System.Data.SqlClient took 14 seconds
using the System.Data.Odbc took 13 seconds
using the System.Data.OleDb took 12 seconds
I have tried running these tests in different orders also and get the same results. I realise the times are close but I am concerned about scalibility.
Robby White
"David Schleifer [MSFT]" wrote:

> By native provider, do you mean System.Data.SqlClient? In general SqlClient
> is a good deal faster than using the combination of System.Data.OleDb and
> the native oledb provider for sql server. To comment further, I'd need to
> know more about your scenario.
> Thanks,
> Dave
> "Robby White" <Robby White@.discussions.microsoft.com> wrote in message
> news:04E120F8-5A6E-42F9-80E9-8BBD32B887C3@.microsoft.com...
> insert 4000 rows across multiple tables using the OLE DB provider in 11
> seconds but when using the native provider it takes 13 seconds.
> not decrease it? Why is this?
>
>
|||The insert operation is a fairly simple one, compared to other provider
operations such as reading data, so it's hard for any one provider to exceed
another once it's been reasonbly optimized. If you want to compare overall
provider performance, whatever benchmark you choose would have to include a
fair measure of read operations, which is one of the areas where SqlClient
really outperforms the oledb managed provider.
That said, when I tried a simple test with 16000 distinct insert operations
(i.e. seperate round trip for each), I got results for SqlClient that were
1-2% better than the OleDb provider. I think it's fair to say that the two
providers are basically equivalent for many types of insert operations, but
overall for best performance you will be better off with SqlClient.
If you are only interested in insert performance, you will probably want to
check out the Whidbey release of .NET, where SqlClient supports a bulk load
api.
"Robby White" <RobbyWhite@.discussions.microsoft.com> wrote in message
news:8A9CA873-B3B5-44B7-B2D9-296FFE988FC5@.microsoft.com...
> Yes I mean the System.Data.SqlClient provider.
> Inserting 4000 records into SQL Server 2000
> using the System.Data.SqlClient took 14 seconds
> using the System.Data.Odbc took 13 seconds
> using the System.Data.OleDb took 12 seconds
> I have tried running these tests in different orders also and get the same
results. I realise the times are close but I am concerned about
scalibility.[vbcol=seagreen]
> Robby White
> "David Schleifer [MSFT]" wrote:
SqlClient[vbcol=seagreen]
and[vbcol=seagreen]
to[vbcol=seagreen]
performance[vbcol=seagreen]
|||Thanks for your help...
"David Schleifer [MSFT]" wrote:

> The insert operation is a fairly simple one, compared to other provider
> operations such as reading data, so it's hard for any one provider to exceed
> another once it's been reasonbly optimized. If you want to compare overall
> provider performance, whatever benchmark you choose would have to include a
> fair measure of read operations, which is one of the areas where SqlClient
> really outperforms the oledb managed provider.
> That said, when I tried a simple test with 16000 distinct insert operations
> (i.e. seperate round trip for each), I got results for SqlClient that were
> 1-2% better than the OleDb provider. I think it's fair to say that the two
> providers are basically equivalent for many types of insert operations, but
> overall for best performance you will be better off with SqlClient.
> If you are only interested in insert performance, you will probably want to
> check out the Whidbey release of .NET, where SqlClient supports a bulk load
> api.
>
> "Robby White" <RobbyWhite@.discussions.microsoft.com> wrote in message
> news:8A9CA873-B3B5-44B7-B2D9-296FFE988FC5@.microsoft.com...
> results. I realise the times are close but I am concerned about
> scalibility.
> SqlClient
> and
> to
> performance
>
>

.NET Performance - Native vs OLE DB

Using a local instance of SQL Server 2000 and .NET I have managed to insert
4000 rows across multiple tables using the OLE DB provider in 11 seconds but
when using the native provider it takes 13 seconds.
I was under the impression the native provider should enhance performance no
t decrease it? Why is this?
Thanks, RobbyBy native provider, do you mean System.Data.SqlClient? In general SqlClient
is a good deal faster than using the combination of System.Data.OleDb and
the native oledb provider for sql server. To comment further, I'd need to
know more about your scenario.
Thanks,
Dave
"Robby White" <Robby White@.discussions.microsoft.com> wrote in message
news:04E120F8-5A6E-42F9-80E9-8BBD32B887C3@.microsoft.com...
> Using a local instance of SQL Server 2000 and .NET I have managed to
insert 4000 rows across multiple tables using the OLE DB provider in 11
seconds but when using the native provider it takes 13 seconds.
> I was under the impression the native provider should enhance performance
not decrease it? Why is this?
> Thanks, Robby|||Yes I mean the System.Data.SqlClient provider.
Inserting 4000 records into SQL Server 2000
using the System.Data.SqlClient took 14 seconds
using the System.Data.Odbc took 13 seconds
using the System.Data.OleDb took 12 seconds
I have tried running these tests in different orders also and get the same r
esults. I realise the times are close but I am concerned about scalibility.
Robby White
"David Schleifer [MSFT]" wrote:

> By native provider, do you mean System.Data.SqlClient? In general SqlClien
t
> is a good deal faster than using the combination of System.Data.OleDb and
> the native oledb provider for sql server. To comment further, I'd need to
> know more about your scenario.
> Thanks,
> Dave
> "Robby White" <Robby White@.discussions.microsoft.com> wrote in message
> news:04E120F8-5A6E-42F9-80E9-8BBD32B887C3@.microsoft.com...
> insert 4000 rows across multiple tables using the OLE DB provider in 11
> seconds but when using the native provider it takes 13 seconds.
> not decrease it? Why is this?
>
>|||The insert operation is a fairly simple one, compared to other provider
operations such as reading data, so it's hard for any one provider to exceed
another once it's been reasonbly optimized. If you want to compare overall
provider performance, whatever benchmark you choose would have to include a
fair measure of read operations, which is one of the areas where SqlClient
really outperforms the oledb managed provider.
That said, when I tried a simple test with 16000 distinct insert operations
(i.e. seperate round trip for each), I got results for SqlClient that were
1-2% better than the OleDb provider. I think it's fair to say that the two
providers are basically equivalent for many types of insert operations, but
overall for best performance you will be better off with SqlClient.
If you are only interested in insert performance, you will probably want to
check out the Whidbey release of .NET, where SqlClient supports a bulk load
api.
"Robby White" <RobbyWhite@.discussions.microsoft.com> wrote in message
news:8A9CA873-B3B5-44B7-B2D9-296FFE988FC5@.microsoft.com...
> Yes I mean the System.Data.SqlClient provider.
> Inserting 4000 records into SQL Server 2000
> using the System.Data.SqlClient took 14 seconds
> using the System.Data.Odbc took 13 seconds
> using the System.Data.OleDb took 12 seconds
> I have tried running these tests in different orders also and get the same
results. I realise the times are close but I am concerned about
scalibility.[vbcol=seagreen]
> Robby White
> "David Schleifer [MSFT]" wrote:
>
SqlClient[vbcol=seagreen]
and[vbcol=seagreen]
to[vbcol=seagreen]
performance[vbcol=seagreen]|||Thanks for your help...
"David Schleifer [MSFT]" wrote:

> The insert operation is a fairly simple one, compared to other provider
> operations such as reading data, so it's hard for any one provider to exce
ed
> another once it's been reasonbly optimized. If you want to compare overall
> provider performance, whatever benchmark you choose would have to include
a
> fair measure of read operations, which is one of the areas where SqlClient
> really outperforms the oledb managed provider.
> That said, when I tried a simple test with 16000 distinct insert operation
s
> (i.e. seperate round trip for each), I got results for SqlClient that were
> 1-2% better than the OleDb provider. I think it's fair to say that the two
> providers are basically equivalent for many types of insert operations, bu
t
> overall for best performance you will be better off with SqlClient.
> If you are only interested in insert performance, you will probably want t
o
> check out the Whidbey release of .NET, where SqlClient supports a bulk loa
d
> api.
>
> "Robby White" <RobbyWhite@.discussions.microsoft.com> wrote in message
> news:8A9CA873-B3B5-44B7-B2D9-296FFE988FC5@.microsoft.com...
> results. I realise the times are close but I am concerned about
> scalibility.
> SqlClient
> and
> to
> performance
>
>

Thursday, February 16, 2012

**to trace what has happened**

Hi
In SQL2000, how can I find what has happened in my DB in particular date?
for example I insert a ne row in table1 and I update 2 rows in table2. now
how can find what did I perfome?
I don't want to monitor the changes simentanously, I want to refer to them
afre some times.
should I refer to .log file of my db?(if ye ,how?) or should I do
something else?
any help would be thanked.Hi,
SQL Server will not log the events by default. In this case probably you can
write triggers to audit the Delete/Insert and Update events.
Thanks
Hari
SQL Server MVP
"M" <rez1824@.yahoo.co.uk> wrote in message
news:op.tf2mdvein9ig5y@.system109.parskhazar.net...
> Hi
> In SQL2000, how can I find what has happened in my DB in particular date?
> for example I insert a ne row in table1 and I update 2 rows in table2. now
> how can find what did I perfome?
> I don't want to monitor the changes simentanously, I want to refer to them
> afre some times.
> should I refer to .log file of my db?(if ye ,how?) or should I do
> something else?
> any help would be thanked.|||you could enable c2 auditing as many gov types are forced to do.
mike.menard
"M" <rez1824@.yahoo.co.uk> wrote in message
news:op.tf2mdvein9ig5y@.system109.parskhazar.net...
> Hi
> In SQL2000, how can I find what has happened in my DB in particular date?
> for example I insert a ne row in table1 and I update 2 rows in table2. now
> how can find what did I perfome?
> I don't want to monitor the changes simentanously, I want to refer to them
> afre some times.
> should I refer to .log file of my db?(if ye ,how?) or should I do
> something else?
> any help would be thanked.|||I think it does it, cause when we set the database in full mode it somehow
save the changes so it can use it when it wants to restore the db based on
the last changes.
is it right?
in other words, if I want to know what has happened during a period of
time should I save the changes as a log file, or is there any place to
have it systematically?
thanks
On Mon, 18 Sep 2006 15:17:22 +0330, Hari Prasad
<hari_prasad_k@.hotmail.com> wrote:

> Hi,
> SQL Server will not log the events by default. In this case probably you
> can
> write triggers to audit the Delete/Insert and Update events.
> Thanks
> Hari
> SQL Server MVP
> "M" <rez1824@.yahoo.co.uk> wrote in message
> news:op.tf2mdvein9ig5y@.system109.parskhazar.net...
>
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/|||Have a look at these:
http://sqlserver2000.databases.aspf...erver-data.html
Andrew J. Kelly SQL MVP
"M" <rez1824@.yahoo.co.uk> wrote in message
news:op.tf33aps8n9ig5y@.system109.parskhazar.net...
>I think it does it, cause when we set the database in full mode it somehow
>save the changes so it can use it when it wants to restore the db based on
>the last changes.
> is it right?
> in other words, if I want to know what has happened during a period of
> time should I save the changes as a log file, or is there any place to
> have it systematically?
> thanks
> On Mon, 18 Sep 2006 15:17:22 +0330, Hari Prasad
> <hari_prasad_k@.hotmail.com> wrote:
>
>
> --
> Using Opera's revolutionary e-mail client: http://www.opera.com/mail/

Monday, February 13, 2012

** help, need to restore specific records from backup copy of database

I've got an SQL 2000 database where some rows were killed by running:
dbcc CHECKDB ('theDb', repair_allow_data_loss)
The primary key is an auto incrementing integer.
I have an older copy of the database, with all the missing rows, located on an
SQL 2005 box.
I can connect to both databases (located on different machines) using SQL 2005
Server Management Console.
How can I write some sql to quickly move the records (keeping the same primary
key) from the good database to the bad one.
I have a list of all the primary keys of the records that need to be restored
(and the sql to generate that list, so I can handle that part of the query to
move the data).
--
Thanks in advance, Les CaudleThe easiest method might be to query the SQL Server 2005 box via a linked
server or OPENQUERY. You would want to query the rows that you want to
insert.
You would use SET IDENTITY_INSERT tablename ON before inserting into the
table with the identity value as the primary key.
Hopefully that gives you enough information to start working on a solution.
--
Keith Kratochvil
"Les Caudle" <very@.tiredofspam.com> wrote in message
news:kcep72dcjesf6ss1ebcvuc1676em7ltopn@.4ax.com...
> I've got an SQL 2000 database where some rows were killed by running:
> dbcc CHECKDB ('theDb', repair_allow_data_loss)
> The primary key is an auto incrementing integer.
> I have an older copy of the database, with all the missing rows, located
> on an
> SQL 2005 box.
> I can connect to both databases (located on different machines) using SQL
> 2005
> Server Management Console.
> How can I write some sql to quickly move the records (keeping the same
> primary
> key) from the good database to the bad one.
> I have a list of all the primary keys of the records that need to be
> restored
> (and the sql to generate that list, so I can handle that part of the query
> to
> move the data).
> --
> Thanks in advance, Les Caudle|||One easy way is to use the DTS Import/Export Wizard. Once you specify your
query and destination table, select Transform and 'Enable identity insert'.
Test it with copies of your databases first, just in case.
Hope this helps,
Ben Nevarez, MCDBA, OCP
Database Administrator
"Les Caudle" wrote:
> I've got an SQL 2000 database where some rows were killed by running:
> dbcc CHECKDB ('theDb', repair_allow_data_loss)
> The primary key is an auto incrementing integer.
> I have an older copy of the database, with all the missing rows, located on an
> SQL 2005 box.
> I can connect to both databases (located on different machines) using SQL 2005
> Server Management Console.
> How can I write some sql to quickly move the records (keeping the same primary
> key) from the good database to the bad one.
> I have a list of all the primary keys of the records that need to be restored
> (and the sql to generate that list, so I can handle that part of the query to
> move the data).
> --
> Thanks in advance, Les Caudle
>|||Keith - I copied the backup table into a new database on the server with the
problem. Then I tried to run this query (wiht a few more fields in the select)
SET IDENTITY_INSERT dbo.Customers ON
GO
INSERT INTO dbo.Customers
SELECT CustomerID,
fName,
lName,
EmailAddress
FROM Olddb.dbo.Customers
WHERE Olddb.dbo.Customers.customerId in
(117,
236,
238
)
GO
SET IDENTITY_INSERT dbo.Customers OFF
GO
I keep getting this error msg:
Msg 8101, Level 16, State 1, Line 1
An explicit value for the identity column in table 'Customers' can only be
specified when a column list is used and IDENTITY_INSERT is ON.
I don't understand. I have both a column list and IDENTITY_INSERT is ON
Thanks, Les Caudle
On Tue, 30 May 2006 16:59:39 -0500, "Keith Kratochvil"
<sqlguy.back2u@.comcast.net> wrote:
>The easiest method might be to query the SQL Server 2005 box via a linked
>server or OPENQUERY. You would want to query the rows that you want to
>insert.
>You would use SET IDENTITY_INSERT tablename ON before inserting into the
>table with the identity value as the primary key.
>
>Hopefully that gives you enough information to start working on a solution.|||MS books on line seem to be incorrect, I followed their example and got that
error msg.
To get it to work, I needed to modify the code as follows:
INSERT INTO dbo.Customers (CustomerID,
fName,
lName,
EmailAddress)
etc. etc.
so that I had a column list for the source as well as destination tables
On Tue, 30 May 2006 18:38:27 -0500, Les Caudle <very@.tiredofspam.com> wrote:
>Keith - I copied the backup table into a new database on the server with the
>problem. Then I tried to run this query (wiht a few more fields in the select)
>SET IDENTITY_INSERT dbo.Customers ON
>GO
>INSERT INTO dbo.Customers
> SELECT CustomerID,
> fName,
> lName,
> EmailAddress
> FROM Olddb.dbo.Customers
> WHERE Olddb.dbo.Customers.customerId in
> (117,
> 236,
> 238
> )
>GO
>SET IDENTITY_INSERT dbo.Customers OFF
>GO
>
>I keep getting this error msg:
>Msg 8101, Level 16, State 1, Line 1
>An explicit value for the identity column in table 'Customers' can only be
>specified when a column list is used and IDENTITY_INSERT is ON.
>I don't understand. I have both a column list and IDENTITY_INSERT is ON
>Thanks, Les Caudle
>On Tue, 30 May 2006 16:59:39 -0500, "Keith Kratochvil"
><sqlguy.back2u@.comcast.net> wrote:
>>The easiest method might be to query the SQL Server 2005 box via a linked
>>server or OPENQUERY. You would want to query the rows that you want to
>>insert.
>>You would use SET IDENTITY_INSERT tablename ON before inserting into the
>>table with the identity value as the primary key.
>>
>>Hopefully that gives you enough information to start working on a solution.|||Correct. I always specify column names within the insert statement. That
keeps things working even if somebody changes the order of the columns in a
table. It also makes this insert statement work. I am glad you discovered
the correct T-SQL.
--
Keith Kratochvil
"Les Caudle" <very@.tiredofspam.com> wrote in message
news:8amp72t9gpecjbgheki1h0h89v7b3hpkia@.4ax.com...
> MS books on line seem to be incorrect, I followed their example and got
> that
> error msg.
> To get it to work, I needed to modify the code as follows:
> INSERT INTO dbo.Customers (CustomerID,
> fName,
> lName,
> EmailAddress)
> etc. etc.
> so that I had a column list for the source as well as destination tables
> On Tue, 30 May 2006 18:38:27 -0500, Les Caudle <very@.tiredofspam.com>
> wrote:
>>Keith - I copied the backup table into a new database on the server with
>>the
>>problem. Then I tried to run this query (wiht a few more fields in the
>>select)
>>SET IDENTITY_INSERT dbo.Customers ON
>>GO
>>INSERT INTO dbo.Customers
>> SELECT CustomerID,
>> fName,
>> lName,
>> EmailAddress
>> FROM Olddb.dbo.Customers
>> WHERE Olddb.dbo.Customers.customerId in
>> (117,
>> 236,
>> 238
>> )
>>GO
>>SET IDENTITY_INSERT dbo.Customers OFF
>>GO
>>
>>I keep getting this error msg:
>>Msg 8101, Level 16, State 1, Line 1
>>An explicit value for the identity column in table 'Customers' can only be
>>specified when a column list is used and IDENTITY_INSERT is ON.
>>I don't understand. I have both a column list and IDENTITY_INSERT is ON
>>Thanks, Les Caudle
>>On Tue, 30 May 2006 16:59:39 -0500, "Keith Kratochvil"
>><sqlguy.back2u@.comcast.net> wrote:
>>The easiest method might be to query the SQL Server 2005 box via a linked
>>server or OPENQUERY. You would want to query the rows that you want to
>>insert.
>>You would use SET IDENTITY_INSERT tablename ON before inserting into the
>>table with the identity value as the primary key.
>>
>>Hopefully that gives you enough information to start working on a
>>solution.
>

** help, need to restore specific records from backup copy of database

I've got an SQL 2000 database where some rows were killed by running:
dbcc CHECKDB ('theDb', repair_allow_data_loss)
The primary key is an auto incrementing integer.
I have an older copy of the database, with all the missing rows, located on
an
SQL 2005 box.
I can connect to both databases (located on different machines) using SQL 20
05
Server Management Console.
How can I write some sql to quickly move the records (keeping the same prima
ry
key) from the good database to the bad one.
I have a list of all the primary keys of the records that need to be restore
d
(and the sql to generate that list, so I can handle that part of the query t
o
move the data).
Thanks in advance, Les CaudleThe easiest method might be to query the SQL Server 2005 box via a linked
server or OPENQUERY. You would want to query the rows that you want to
insert.
You would use SET IDENTITY_INSERT tablename ON before inserting into the
table with the identity value as the primary key.
Hopefully that gives you enough information to start working on a solution.
Keith Kratochvil
"Les Caudle" <very@.tiredofspam.com> wrote in message
news:kcep72dcjesf6ss1ebcvuc1676em7ltopn@.
4ax.com...
> I've got an SQL 2000 database where some rows were killed by running:
> dbcc CHECKDB ('theDb', repair_allow_data_loss)
> The primary key is an auto incrementing integer.
> I have an older copy of the database, with all the missing rows, located
> on an
> SQL 2005 box.
> I can connect to both databases (located on different machines) using SQL
> 2005
> Server Management Console.
> How can I write some sql to quickly move the records (keeping the same
> primary
> key) from the good database to the bad one.
> I have a list of all the primary keys of the records that need to be
> restored
> (and the sql to generate that list, so I can handle that part of the query
> to
> move the data).
> --
> Thanks in advance, Les Caudle|||Keith - I copied the backup table into a new database on the server with the
problem. Then I tried to run this query (wiht a few more fields in the sele
ct)
SET IDENTITY_INSERT dbo.Customers ON
GO
INSERT INTO dbo.Customers
SELECT CustomerID,
fName,
lName,
EmailAddress
FROM Olddb.dbo.Customers
WHERE Olddb.dbo.Customers.customerId in
(117,
236,
238
)
GO
SET IDENTITY_INSERT dbo.Customers OFF
GO
I keep getting this error msg:
Msg 8101, Level 16, State 1, Line 1
An explicit value for the identity column in table 'Customers' can only be
specified when a column list is used and IDENTITY_INSERT is ON.
I don't understand. I have both a column list and IDENTITY_INSERT is ON
Thanks, Les Caudle
On Tue, 30 May 2006 16:59:39 -0500, "Keith Kratochvil"
<sqlguy.back2u@.comcast.net> wrote:

>The easiest method might be to query the SQL Server 2005 box via a linked
>server or OPENQUERY. You would want to query the rows that you want to
>insert.
>You would use SET IDENTITY_INSERT tablename ON before inserting into the
>table with the identity value as the primary key.
>
>Hopefully that gives you enough information to start working on a solution.|||MS books on line seem to be incorrect, I followed their example and got that
error msg.
To get it to work, I needed to modify the code as follows:
INSERT INTO dbo.Customers (CustomerID,
fName,
lName,
EmailAddress)
etc. etc.
so that I had a column list for the source as well as destination tables
On Tue, 30 May 2006 18:38:27 -0500, Les Caudle <very@.tiredofspam.com> wrote:
[vbcol=seagreen]
>Keith - I copied the backup table into a new database on the server with th
e
>problem. Then I tried to run this query (wiht a few more fields in the sel
ect)
>SET IDENTITY_INSERT dbo.Customers ON
>GO
>INSERT INTO dbo.Customers
> SELECT CustomerID,
> fName,
> lName,
> EmailAddress
> FROM Olddb.dbo.Customers
> WHERE Olddb.dbo.Customers.customerId in
> (117,
> 236,
> 238
> )
>GO
>SET IDENTITY_INSERT dbo.Customers OFF
>GO
>
>I keep getting this error msg:
>Msg 8101, Level 16, State 1, Line 1
>An explicit value for the identity column in table 'Customers' can only be
>specified when a column list is used and IDENTITY_INSERT is ON.
>I don't understand. I have both a column list and IDENTITY_INSERT is ON
>Thanks, Les Caudle
>On Tue, 30 May 2006 16:59:39 -0500, "Keith Kratochvil"
><sqlguy.back2u@.comcast.net> wrote:
>|||Correct. I always specify column names within the insert statement. That
keeps things working even if somebody changes the order of the columns in a
table. It also makes this insert statement work. I am glad you discovered
the correct T-SQL.
Keith Kratochvil
"Les Caudle" <very@.tiredofspam.com> wrote in message
news:8amp72t9gpecjbgheki1h0h89v7b3hpkia@.
4ax.com...
> MS books on line seem to be incorrect, I followed their example and got
> that
> error msg.
> To get it to work, I needed to modify the code as follows:
> INSERT INTO dbo.Customers (CustomerID,
> fName,
> lName,
> EmailAddress)
> etc. etc.
> so that I had a column list for the source as well as destination tables
> On Tue, 30 May 2006 18:38:27 -0500, Les Caudle <very@.tiredofspam.com>
> wrote:
>
>

Saturday, February 11, 2012

(system) Variable that holds the record count of a result set?

Hello
is there a variable that is available to me that contains the number
of rows contained in a dataset return from a database call?

have a class that runs a stored proc and returns a dataset/resultset
looking to simply assign an integer this value if it is possible

i'm using (learning) vb.net and sql server

thanks in advance

If you are using a dataset, you can get the number of rows with this syntax:

DataSet1.tables(0).rows.count (assuming your Dataset returns only 1 resultset. If you have more than 1, just replace the zero with whatever index you need.)

If you use a DataReader, which tends to be faster, this property is not available, unfortunately.|||

hello. thank you for the reply. that is exactly what i was looking for (DataSet1.tables(0).rows.count). a question about how to reference this from the codebehind...

i have a codebehind that Dims a class, the class returns the dataset, in the codebehind i have a line likeDropDownList1.DataSource = myClass.function1(parm1) to populate the dropdown with the data from the dataset. i get how i could reference this value in the class code, but how would i reference it in the codebehind? is there a way. would i have to do it in the class function and store it in a session variable or something? would be like to reference it directly in the codebehind as that is where i would be using the value.

thanks again.

|||

i believe i have figured my question out (yup, i'm new), but if you have any comments i'd appreciate it

instead of directly coding the line as DDL1.DataSource = myClass.function1(parm1)

i modified the code to have...

Dim ds as dataSet = myClass.function1(parm1)
Dim dsCnt as integer = ds.Tables(0).Rows.Count()
DDL1.DataSource = ds

this seemed to get me what i was after. if there is a more efficient or elegant way to do this, i'm all earsSmile [:)]

|||The way you've done it is fine. An alternative is to create a property of type dataset in your class, then fill that property in your function. The code behind could then reference your property.

Public Class myClass

Private mMyDataset as dataset

Public Sub New()
MyBase.new()
End Sub

Property MyDataset() As dataset
Get
Return mMyDataset
End Get
Set(ByVal Value As dataset)
mMyDataset = Value
End Set
End Property

Public Sub function1(param) 'can change to a sub since you are filling a property rather than using a return value
myDataset = Database call goes here
End Sub

From your code behind:

dim objClass as new myClass()

with objClass
.function1(param)
DDL1.datasource = .myDataset
DDL1.databind
end with

Thursday, February 9, 2012

(RS 2000) Row Count in Header?

I am using Reporting Services 2000 and need to know if there is a way to
list the number of rows returned in the Header or Footer?
Any help is greatly appreciated.
- CarlCarl,
If you use the COUNT function in SSRS, it should calculate that for
you. In one of the header/footer cells, make the expression something
like: =Count(Fields!fieldName.Value)
You can make these more informative by putting a descriptor after the
count value like: =Count(Fields!fieldName.Value) &
Iif(Count(Fields!fieldName.Value) = 1, " Employee", " Employees")
Also, the count function just looks within its own scope. If you use a
table header, it looks at the whole table. If you use a group header,
it looks just within its group.
Hope this helps!
-Josh
Vagabond Software wrote:
> I am using Reporting Services 2000 and need to know if there is a way to
> list the number of rows returned in the Header or Footer?
> Any help is greatly appreciated.
> - Carl|||"Josh" <bell.joshua@.gmail.com> wrote in message
news:1155300982.086540.318880@.p79g2000cwp.googlegroups.com...
> Carl,
> If you use the COUNT function in SSRS, it should calculate that for
> you. In one of the header/footer cells, make the expression something
> like: =Count(Fields!fieldName.Value)
> You can make these more informative by putting a descriptor after the
> count value like: =Count(Fields!fieldName.Value) &
> Iif(Count(Fields!fieldName.Value) = 1, " Employee", " Employees")
> Also, the count function just looks within its own scope. If you use a
> table header, it looks at the whole table. If you use a group header,
> it looks just within its group.
> Hope this helps!
> -Josh
Though I couldn't use the COUNT function in the Header or the Footer, I was
able to make space in the Body, above the table, to use the function.
Thanks for the help.
- Carl|||Carl,
Glad you got it working, but you might want to further investigate the
Count problem... I borrowed a friends workstation that has SSRS 2000
and confirmed that the Count function DOES work in that version of the
product.
I made a simple query that returned 1 field and put a Count expression
in the table footer. It displayed the correct number.
Best wishes!
-Josh
Vagabond Software wrote:
> "Josh" <bell.joshua@.gmail.com> wrote in message
> news:1155300982.086540.318880@.p79g2000cwp.googlegroups.com...
> >
> > Carl,
> >
> > If you use the COUNT function in SSRS, it should calculate that for
> > you. In one of the header/footer cells, make the expression something
> > like: =Count(Fields!fieldName.Value)
> >
> > You can make these more informative by putting a descriptor after the
> > count value like: =Count(Fields!fieldName.Value) &
> > Iif(Count(Fields!fieldName.Value) = 1, " Employee", " Employees")
> >
> > Also, the count function just looks within its own scope. If you use a
> > table header, it looks at the whole table. If you use a group header,
> > it looks just within its group.
> >
> > Hope this helps!
> >
> > -Josh
>
> Though I couldn't use the COUNT function in the Header or the Footer, I was
> able to make space in the Body, above the table, to use the function.
> Thanks for the help.
> - Carl|||"Josh" <bell.joshua@.gmail.com> wrote in message
news:1155530591.436146.248650@.75g2000cwc.googlegroups.com...
> Carl,
> Glad you got it working, but you might want to further investigate the
> Count problem... I borrowed a friends workstation that has SSRS 2000
> and confirmed that the Count function DOES work in that version of the
> product.
> I made a simple query that returned 1 field and put a Count expression
> in the table footer. It displayed the correct number.
> Best wishes!
> -Josh
I will keep playing with it, but if I add a Textbox to the footer and
attempt to use the Count expression in the Value property of that Textbox, I
get a build error something like this:
"The value expression for the textbox 'textbox15' refers to a field. Fields
cannot be used in page headers or footers."
Thanks for all the help.
- carl|||Carl,
You are adding the textbox to the PAGE footer, not the table footer.
The table is bound to a dataset, so you can reference a field in the
table footer by using "Fields!fieldName.Value" without having to
specify the dataset to which that field belongs.
If you add a textbox to the body, page header, or page footer, you need
to reference the dataset as well. Usually, one you do this, it has to
return a scalar value, so you might be forced to use a First, Last,
Sum, Count, etc. function to condense the result into a single value.
If you use the expression builder (right-click on the textbox and
select Expression), you can click on Datasets on the left and see your
options. If it is a text datatype, I think it defaults to First; if it
is a number datatype, I think it defaults to Sum. The expression will
automatically add the name of the dataset using the correct syntax.
If you need it in the PAGE footer, try this approach. If you meant it
to be a table footer, it should be a simple
Count(Fields!fieldName.Value).
Any closer?
-Josh
Vagabond Software wrote:
> "Josh" <bell.joshua@.gmail.com> wrote in message
> news:1155530591.436146.248650@.75g2000cwc.googlegroups.com...
> >
> > Carl,
> >
> > Glad you got it working, but you might want to further investigate the
> > Count problem... I borrowed a friends workstation that has SSRS 2000
> > and confirmed that the Count function DOES work in that version of the
> > product.
> >
> > I made a simple query that returned 1 field and put a Count expression
> > in the table footer. It displayed the correct number.
> >
> > Best wishes!
> >
> > -Josh
> I will keep playing with it, but if I add a Textbox to the footer and
> attempt to use the Count expression in the Value property of that Textbox, I
> get a build error something like this:
> "The value expression for the textbox 'textbox15' refers to a field. Fields
> cannot be used in page headers or footers."
> Thanks for all the help.
> - carl