Showing posts with label values. Show all posts
Showing posts with label values. Show all posts

Friday, March 23, 2012

Lock issue during insert

:confused:

I opened 2 sql analizer windows to simulate 2 users:

In the first one I did this:
begin transaction;
insert into tst values (15);

In the second one I sent
begin transaction;
select * from tst where col=3;

The second statement is blocked waiting for the lock to be released.
Why? I tried update in plce of the insert and then there is no lock.

What is the problem with insert ?

regards

phildo you have an index on col?
if not then the select will do a table scan and be blocked. It will return nothing until the output buffer is full or the lock is released.

In both cases you should find a few intent exclusive locks and at least one exclusive.

If the select tries to access a resource that is locked then it will be blocked - if not it won't be.

Maybe your insert was forcing some page splits whereas the update wasn't?|||You're right, it does not happen when an index is on the table.
Why this happen only for inserts , and not updates.
What do you mean by lock return when the buffer is full.
regards

phil|||>> What do you mean by lock return when the buffer is full.
When you run a query in query analyser the output will be dumped to the result window when the output buffer is full or when the query completes. That's why if you run a large select you will see the results in batches - and why it doesn't mean that a query is stuck after the last result displayed.

It should happen for both inserts and updates - it just depends on what is being locked.

Lock counters - odd values

Hi,
{SQL Server 2000}
I'm just beginning to look at counters, so sorry if these are obvious.
I've just taken a look at sysperfinfo and found these values:
SQLServer:Locks Lock Requests/sec _Total -249742468
SQLServer:Locks Lock Timeouts/sec _Total 315800
SQLServer:Locks Number of Deadlocks/sec _Total 0
SQLServer:Locks Lock Waits/sec _Total 93
SQLServer:Locks Lock Wait Time (ms) _Total 6787689
SQLServer:Locks Average Wait Time (ms) _Total 6787689
SQLServer:Locks Average Wait Time Base _Total 93
Is it okay to look at _total or is it misleading?
Why is Lock Requests/sec negative?
The wait time looks very large: is this usual?
Over what time period are the averages based? How do you reset the
averages?
Cheers,
JamesI don't know the specifics of this particular counter. But not all perfmon
counters are properly instrumented. For instance, at least one of the SQL
waits counters I often monitor would display a very huge ridiculous number
from time to time, and %Disk Time is often well over 100%.
When I run into a situation like this, I know I can't rely on the counter
and I'll just skip the counter and focus on other counters instead. The good
news is that not getting proper values from one or two counters doesn't mean
you can't get a good assessment of your system.
Linchi
"JimLad" wrote:
> Hi,
> {SQL Server 2000}
> I'm just beginning to look at counters, so sorry if these are obvious.
> I've just taken a look at sysperfinfo and found these values:
> SQLServer:Locks Lock Requests/sec _Total -249742468
> SQLServer:Locks Lock Timeouts/sec _Total 315800
> SQLServer:Locks Number of Deadlocks/sec _Total 0
> SQLServer:Locks Lock Waits/sec _Total 93
> SQLServer:Locks Lock Wait Time (ms) _Total 6787689
> SQLServer:Locks Average Wait Time (ms) _Total 6787689
> SQLServer:Locks Average Wait Time Base _Total 93
> Is it okay to look at _total or is it misleading?
> Why is Lock Requests/sec negative?
> The wait time looks very large: is this usual?
> Over what time period are the averages based? How do you reset the
> averages?
> Cheers,
> James
>|||On Oct 19, 3:28 pm, Linchi Shea <LinchiS...@.discussions.microsoft.com>
wrote:
> I don't know the specifics of this particular counter. But not all perfmon
> counters are properly instrumented. For instance, at least one of the SQL
> waits counters I often monitor would display a very huge ridiculous number
> from time to time, and %Disk Time is often well over 100%.
> When I run into a situation like this, I know I can't rely on the counter
> and I'll just skip the counter and focus on other counters instead. The good
> news is that not getting proper values from one or two counters doesn't mean
> you can't get a good assessment of your system.
> Linchi
>
> "JimLad" wrote:
> > Hi,
> > {SQL Server 2000}
> > I'm just beginning to look at counters, so sorry if these are obvious.
> > I've just taken a look at sysperfinfo and found these values:
> > SQLServer:Locks Lock Requests/sec _Total -249742468
> > SQLServer:Locks Lock Timeouts/sec _Total 315800
> > SQLServer:Locks Number of Deadlocks/sec _Total 0
> > SQLServer:Locks Lock Waits/sec _Total 93
> > SQLServer:Locks Lock Wait Time (ms) _Total 6787689
> > SQLServer:Locks Average Wait Time (ms) _Total 6787689
> > SQLServer:Locks Average Wait Time Base _Total 93
> > Is it okay to look at _total or is it misleading?
> > Why is Lock Requests/sec negative?
> > The wait time looks very large: is this usual?
> > Over what time period are the averages based? How do you reset the
> > averages?
> > Cheers,
> > James- Hide quoted text -
> - Show quoted text -
Thanks. Can anyone comment more specifically on this case?
Cheers,
James|||On Oct 19, 4:56 pm, JimLad <jamesdbi...@.yahoo.co.uk> wrote:
> On Oct 19, 3:28 pm, Linchi Shea <LinchiS...@.discussions.microsoft.com>
> wrote:
>
>
> > I don't know the specifics of this particular counter. But not all perfmon
> > counters are properly instrumented. For instance, at least one of the SQL
> > waits counters I often monitor would display a very huge ridiculous number
> > from time to time, and %Disk Time is often well over 100%.
> > When I run into a situation like this, I know I can't rely on the counter
> > and I'll just skip the counter and focus on other counters instead. The good
> > news is that not getting proper values from one or two counters doesn't mean
> > you can't get a good assessment of your system.
> > Linchi
> > "JimLad" wrote:
> > > Hi,
> > > {SQL Server 2000}
> > > I'm just beginning to look at counters, so sorry if these are obvious.
> > > I've just taken a look at sysperfinfo and found these values:
> > > SQLServer:Locks Lock Requests/sec _Total -249742468
> > > SQLServer:Locks Lock Timeouts/sec _Total 315800
> > > SQLServer:Locks Number of Deadlocks/sec _Total 0
> > > SQLServer:Locks Lock Waits/sec _Total 93
> > > SQLServer:Locks Lock Wait Time (ms) _Total 6787689
> > > SQLServer:Locks Average Wait Time (ms) _Total 6787689
> > > SQLServer:Locks Average Wait Time Base _Total 93
> > > Is it okay to look at _total or is it misleading?
> > > Why is Lock Requests/sec negative?
> > > The wait time looks very large: is this usual?
> > > Over what time period are the averages based? How do you reset the
> > > averages?
> > > Cheers,
> > > James- Hide quoted text -
> > - Show quoted text -
> Thanks. Can anyone comment more specifically on this case?
> Cheers,
> James- Hide quoted text -
> - Show quoted text -
Hi,
To answer my own question:
BUG: sysperfinfo counters are not time-adjusted
http://support.microsoft.com/kb/555064%20
This basically says that you can't use any /sec counters from
sysperfinfo.
As for the Average Wait Time (ms), you have to divide this by the base
figure of 93, which still gives me an avergae wait of 73 seconds!
I think I'm going to abandon sysperfinfo and just use the figures from
Perf Mon. Hopefully any calculations have already been performed on
them.
James

Wednesday, March 21, 2012

Location for Temporary File

I have created the following table in Northwind Database:
CREATE TABLE #dts(c1 char(1), dt datetime)
INSERT INTO #dts (c1, dt) VALUES('a', '20040305 09:12:59')
INSERT INTO #dts (c1, dt) VALUES('b', '20040305 16:03:12')
INSERT INTO #dts (c1, dt) VALUES('c', '20040306 00:00:00')
INSERT INTO #dts (c1, dt) VALUES('d', '20040306 02:41:32')
INSERT INTO #dts (c1, dt) VALUES('e', '20040315 11:45:17')
INSERT INTO #dts (c1, dt) VALUES('f', '20040412 09:12:59')
INSERT INTO #dts (c1, dt) VALUES('g', '20040523 11:43:25')
However, when I search in both Northwind and Tempdb
databases, I am not able to find it. I would like to know
where is the Temporary Table being created ?
Thanks
Hi,
All the # (temp) tables and ## (global temp) table will be created in TEMPDB
database. But for temp tables the name will be
created with a unique prefix. This is because temp tables are created every
session and each session a unqie table needs to be created.
How to see this..
Select name from tempdb..sysobjects where name like 'dts%'
Thanks
Hari
SQL Server MVP
"Peter" <anonymous@.discussions.microsoft.com> wrote in message
news:0a0f01c56d8c$8f52e270$a401280a@.phx.gbl...
>I have created the following table in Northwind Database:
> CREATE TABLE #dts(c1 char(1), dt datetime)
> INSERT INTO #dts (c1, dt) VALUES('a', '20040305 09:12:59')
> INSERT INTO #dts (c1, dt) VALUES('b', '20040305 16:03:12')
> INSERT INTO #dts (c1, dt) VALUES('c', '20040306 00:00:00')
> INSERT INTO #dts (c1, dt) VALUES('d', '20040306 02:41:32')
> INSERT INTO #dts (c1, dt) VALUES('e', '20040315 11:45:17')
> INSERT INTO #dts (c1, dt) VALUES('f', '20040412 09:12:59')
> INSERT INTO #dts (c1, dt) VALUES('g', '20040523 11:43:25')
> However, when I search in both Northwind and Tempdb
> databases, I am not able to find it. I would like to know
> where is the Temporary Table being created ?
> Thanks
|||In TempDB
Run the query after your creation
IF OBJECT_ID('tempdb..#dts') IS NOT NULL
PRINT 'TempDB'
ELSE
PRINT 'No'
"Peter" <anonymous@.discussions.microsoft.com> wrote in message
news:0a0f01c56d8c$8f52e270$a401280a@.phx.gbl...
> I have created the following table in Northwind Database:
> CREATE TABLE #dts(c1 char(1), dt datetime)
> INSERT INTO #dts (c1, dt) VALUES('a', '20040305 09:12:59')
> INSERT INTO #dts (c1, dt) VALUES('b', '20040305 16:03:12')
> INSERT INTO #dts (c1, dt) VALUES('c', '20040306 00:00:00')
> INSERT INTO #dts (c1, dt) VALUES('d', '20040306 02:41:32')
> INSERT INTO #dts (c1, dt) VALUES('e', '20040315 11:45:17')
> INSERT INTO #dts (c1, dt) VALUES('f', '20040412 09:12:59')
> INSERT INTO #dts (c1, dt) VALUES('g', '20040523 11:43:25')
> However, when I search in both Northwind and Tempdb
> databases, I am not able to find it. I would like to know
> where is the Temporary Table being created ?
> Thanks
|||Dear Hari,
I do find it by using your query.
In this way, if I want to make query of that temporary table, should I use
the table name dts?
Besides, you mention that temp tables are created every session, does it
mean that it will be deleted automatically at a specific time ? If yes, when
(Like - When I stop SQL Service) ?
Thanks
"Hari Prasad" <hari_prasad_k@.hotmail.com> wrote in message
news:eA7wxCZbFHA.3712@.TK2MSFTNGP09.phx.gbl...
> Hi,
> All the # (temp) tables and ## (global temp) table will be created in
> TEMPDB database. But for temp tables the name will be
> created with a unique prefix. This is because temp tables are created
> every session and each session a unqie table needs to be created.
> How to see this..
> Select name from tempdb..sysobjects where name like 'dts%'
> Thanks
> Hari
> SQL Server MVP
>
> "Peter" <anonymous@.discussions.microsoft.com> wrote in message
> news:0a0f01c56d8c$8f52e270$a401280a@.phx.gbl...
>
|||Why bother about the physical name? Just use the temp table name you gave it.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
Blog: http://solidqualitylearning.com/blogs/tibor/
"Peter" <anonymous@.discussions.microsoft.com> wrote in message
news:0a0f01c56d8c$8f52e270$a401280a@.phx.gbl...
>I have created the following table in Northwind Database:
> CREATE TABLE #dts(c1 char(1), dt datetime)
> INSERT INTO #dts (c1, dt) VALUES('a', '20040305 09:12:59')
> INSERT INTO #dts (c1, dt) VALUES('b', '20040305 16:03:12')
> INSERT INTO #dts (c1, dt) VALUES('c', '20040306 00:00:00')
> INSERT INTO #dts (c1, dt) VALUES('d', '20040306 02:41:32')
> INSERT INTO #dts (c1, dt) VALUES('e', '20040315 11:45:17')
> INSERT INTO #dts (c1, dt) VALUES('f', '20040412 09:12:59')
> INSERT INTO #dts (c1, dt) VALUES('g', '20040523 11:43:25')
> However, when I search in both Northwind and Tempdb
> databases, I am not able to find it. I would like to know
> where is the Temporary Table being created ?
> Thanks
|||Peter wrote:
> Dear Hari,
> I do find it by using your query.
> In this way, if I want to make query of that temporary table, should I use
> the table name dts?
Why not use the temp name (#dts)?

> Besides, you mention that temp tables are created every session, does it
> mean that it will be deleted automatically at a specific time ? If yes, when
> (Like - When I stop SQL Service) ?
>
The table will be dropped as soon as the connection is closed.
Are you trying to access this table from a different connection?
If so, you might want a global temp as already specified ##TableName.
This should be available until the service is restarted.
The beauty of temp tables is they are localized to your current
connection so you can use them in a sp for instance and guarantee that
nothing else will disturb your temp table.
You might well be able to query the name from tempdb and then use it
'normally' but this would defeat the purpose of temp tables and could
well introduce some nasty side effects.
Cheers
JB

> Thanks
> "Hari Prasad" <hari_prasad_k@.hotmail.com> wrote in message
> news:eA7wxCZbFHA.3712@.TK2MSFTNGP09.phx.gbl...
>
>

Monday, March 19, 2012

Location for Temporary File

I have created the following table in Northwind Database:
CREATE TABLE #dts(c1 char(1), dt datetime)
INSERT INTO #dts (c1, dt) VALUES('a', '20040305 09:12:59')
INSERT INTO #dts (c1, dt) VALUES('b', '20040305 16:03:12')
INSERT INTO #dts (c1, dt) VALUES('c', '20040306 00:00:00')
INSERT INTO #dts (c1, dt) VALUES('d', '20040306 02:41:32')
INSERT INTO #dts (c1, dt) VALUES('e', '20040315 11:45:17')
INSERT INTO #dts (c1, dt) VALUES('f', '20040412 09:12:59')
INSERT INTO #dts (c1, dt) VALUES('g', '20040523 11:43:25')
However, when I search in both Northwind and Tempdb
databases, I am not able to find it. I would like to know
where is the Temporary Table being created ?
ThanksHi,
All the # (temp) tables and ## (global temp) table will be created in TEMPDB
database. But for temp tables the name will be
created with a unique prefix. This is because temp tables are created every
session and each session a unqie table needs to be created.
How to see this..
Select name from tempdb..sysobjects where name like 'dts%'
Thanks
Hari
SQL Server MVP
"Peter" <anonymous@.discussions.microsoft.com> wrote in message
news:0a0f01c56d8c$8f52e270$a401280a@.phx.gbl...
>I have created the following table in Northwind Database:
> CREATE TABLE #dts(c1 char(1), dt datetime)
> INSERT INTO #dts (c1, dt) VALUES('a', '20040305 09:12:59')
> INSERT INTO #dts (c1, dt) VALUES('b', '20040305 16:03:12')
> INSERT INTO #dts (c1, dt) VALUES('c', '20040306 00:00:00')
> INSERT INTO #dts (c1, dt) VALUES('d', '20040306 02:41:32')
> INSERT INTO #dts (c1, dt) VALUES('e', '20040315 11:45:17')
> INSERT INTO #dts (c1, dt) VALUES('f', '20040412 09:12:59')
> INSERT INTO #dts (c1, dt) VALUES('g', '20040523 11:43:25')
> However, when I search in both Northwind and Tempdb
> databases, I am not able to find it. I would like to know
> where is the Temporary Table being created ?
> Thanks|||In TempDB
Run the query after your creation
IF OBJECT_ID('tempdb..#dts') IS NOT NULL
PRINT 'TempDB'
ELSE
PRINT 'No'
"Peter" <anonymous@.discussions.microsoft.com> wrote in message
news:0a0f01c56d8c$8f52e270$a401280a@.phx.gbl...
> I have created the following table in Northwind Database:
> CREATE TABLE #dts(c1 char(1), dt datetime)
> INSERT INTO #dts (c1, dt) VALUES('a', '20040305 09:12:59')
> INSERT INTO #dts (c1, dt) VALUES('b', '20040305 16:03:12')
> INSERT INTO #dts (c1, dt) VALUES('c', '20040306 00:00:00')
> INSERT INTO #dts (c1, dt) VALUES('d', '20040306 02:41:32')
> INSERT INTO #dts (c1, dt) VALUES('e', '20040315 11:45:17')
> INSERT INTO #dts (c1, dt) VALUES('f', '20040412 09:12:59')
> INSERT INTO #dts (c1, dt) VALUES('g', '20040523 11:43:25')
> However, when I search in both Northwind and Tempdb
> databases, I am not able to find it. I would like to know
> where is the Temporary Table being created ?
> Thanks|||Dear Hari,
I do find it by using your query.
In this way, if I want to make query of that temporary table, should I use
the table name dts?
Besides, you mention that temp tables are created every session, does it
mean that it will be deleted automatically at a specific time ? If yes, when
(Like - When I stop SQL Service) ?
Thanks
"Hari Prasad" <hari_prasad_k@.hotmail.com> wrote in message
news:eA7wxCZbFHA.3712@.TK2MSFTNGP09.phx.gbl...
> Hi,
> All the # (temp) tables and ## (global temp) table will be created in
> TEMPDB database. But for temp tables the name will be
> created with a unique prefix. This is because temp tables are created
> every session and each session a unqie table needs to be created.
> How to see this..
> Select name from tempdb..sysobjects where name like 'dts%'
> Thanks
> Hari
> SQL Server MVP
>
> "Peter" <anonymous@.discussions.microsoft.com> wrote in message
> news:0a0f01c56d8c$8f52e270$a401280a@.phx.gbl...
>|||Why bother about the physical name? Just use the temp table name you gave it
.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
Blog: http://solidqualitylearning.com/blogs/tibor/
"Peter" <anonymous@.discussions.microsoft.com> wrote in message
news:0a0f01c56d8c$8f52e270$a401280a@.phx.gbl...
>I have created the following table in Northwind Database:
> CREATE TABLE #dts(c1 char(1), dt datetime)
> INSERT INTO #dts (c1, dt) VALUES('a', '20040305 09:12:59')
> INSERT INTO #dts (c1, dt) VALUES('b', '20040305 16:03:12')
> INSERT INTO #dts (c1, dt) VALUES('c', '20040306 00:00:00')
> INSERT INTO #dts (c1, dt) VALUES('d', '20040306 02:41:32')
> INSERT INTO #dts (c1, dt) VALUES('e', '20040315 11:45:17')
> INSERT INTO #dts (c1, dt) VALUES('f', '20040412 09:12:59')
> INSERT INTO #dts (c1, dt) VALUES('g', '20040523 11:43:25')
> However, when I search in both Northwind and Tempdb
> databases, I am not able to find it. I would like to know
> where is the Temporary Table being created ?
> Thanks|||Peter wrote:
> Dear Hari,
> I do find it by using your query.
> In this way, if I want to make query of that temporary table, should I use
> the table name dts?
Why not use the temp name (#dts)?

> Besides, you mention that temp tables are created every session, does it
> mean that it will be deleted automatically at a specific time ? If yes, wh
en
> (Like - When I stop SQL Service) ?
>
The table will be dropped as soon as the connection is closed.
Are you trying to access this table from a different connection?
If so, you might want a global temp as already specified ##TableName.
This should be available until the service is restarted.
The beauty of temp tables is they are localized to your current
connection so you can use them in a sp for instance and guarantee that
nothing else will disturb your temp table.
You might well be able to query the name from tempdb and then use it
'normally' but this would defeat the purpose of temp tables and could
well introduce some nasty side effects.
Cheers
JB

> Thanks
> "Hari Prasad" <hari_prasad_k@.hotmail.com> wrote in message
> news:eA7wxCZbFHA.3712@.TK2MSFTNGP09.phx.gbl...
>
>

Location for Temporary File

I have created the following table in Northwind Database:
CREATE TABLE #dts(c1 char(1), dt datetime)
INSERT INTO #dts (c1, dt) VALUES('a', '20040305 09:12:59')
INSERT INTO #dts (c1, dt) VALUES('b', '20040305 16:03:12')
INSERT INTO #dts (c1, dt) VALUES('c', '20040306 00:00:00')
INSERT INTO #dts (c1, dt) VALUES('d', '20040306 02:41:32')
INSERT INTO #dts (c1, dt) VALUES('e', '20040315 11:45:17')
INSERT INTO #dts (c1, dt) VALUES('f', '20040412 09:12:59')
INSERT INTO #dts (c1, dt) VALUES('g', '20040523 11:43:25')
However, when I search in both Northwind and Tempdb
databases, I am not able to find it. I would like to know
where is the Temporary Table being created ?
ThanksHi,
All the # (temp) tables and ## (global temp) table will be created in TEMPDB
database. But for temp tables the name will be
created with a unique prefix. This is because temp tables are created every
session and each session a unqie table needs to be created.
How to see this..
Select name from tempdb..sysobjects where name like 'dts%'
Thanks
Hari
SQL Server MVP
"Peter" <anonymous@.discussions.microsoft.com> wrote in message
news:0a0f01c56d8c$8f52e270$a401280a@.phx.gbl...
>I have created the following table in Northwind Database:
> CREATE TABLE #dts(c1 char(1), dt datetime)
> INSERT INTO #dts (c1, dt) VALUES('a', '20040305 09:12:59')
> INSERT INTO #dts (c1, dt) VALUES('b', '20040305 16:03:12')
> INSERT INTO #dts (c1, dt) VALUES('c', '20040306 00:00:00')
> INSERT INTO #dts (c1, dt) VALUES('d', '20040306 02:41:32')
> INSERT INTO #dts (c1, dt) VALUES('e', '20040315 11:45:17')
> INSERT INTO #dts (c1, dt) VALUES('f', '20040412 09:12:59')
> INSERT INTO #dts (c1, dt) VALUES('g', '20040523 11:43:25')
> However, when I search in both Northwind and Tempdb
> databases, I am not able to find it. I would like to know
> where is the Temporary Table being created ?
> Thanks|||In TempDB
Run the query after your creation
IF OBJECT_ID('tempdb..#dts') IS NOT NULL
PRINT 'TempDB'
ELSE
PRINT 'No'
"Peter" <anonymous@.discussions.microsoft.com> wrote in message
news:0a0f01c56d8c$8f52e270$a401280a@.phx.gbl...
> I have created the following table in Northwind Database:
> CREATE TABLE #dts(c1 char(1), dt datetime)
> INSERT INTO #dts (c1, dt) VALUES('a', '20040305 09:12:59')
> INSERT INTO #dts (c1, dt) VALUES('b', '20040305 16:03:12')
> INSERT INTO #dts (c1, dt) VALUES('c', '20040306 00:00:00')
> INSERT INTO #dts (c1, dt) VALUES('d', '20040306 02:41:32')
> INSERT INTO #dts (c1, dt) VALUES('e', '20040315 11:45:17')
> INSERT INTO #dts (c1, dt) VALUES('f', '20040412 09:12:59')
> INSERT INTO #dts (c1, dt) VALUES('g', '20040523 11:43:25')
> However, when I search in both Northwind and Tempdb
> databases, I am not able to find it. I would like to know
> where is the Temporary Table being created ?
> Thanks|||Dear Hari,
I do find it by using your query.
In this way, if I want to make query of that temporary table, should I use
the table name dts?
Besides, you mention that temp tables are created every session, does it
mean that it will be deleted automatically at a specific time ? If yes, when
(Like - When I stop SQL Service) ?
Thanks
"Hari Prasad" <hari_prasad_k@.hotmail.com> wrote in message
news:eA7wxCZbFHA.3712@.TK2MSFTNGP09.phx.gbl...
> Hi,
> All the # (temp) tables and ## (global temp) table will be created in
> TEMPDB database. But for temp tables the name will be
> created with a unique prefix. This is because temp tables are created
> every session and each session a unqie table needs to be created.
> How to see this..
> Select name from tempdb..sysobjects where name like 'dts%'
> Thanks
> Hari
> SQL Server MVP
>
> "Peter" <anonymous@.discussions.microsoft.com> wrote in message
> news:0a0f01c56d8c$8f52e270$a401280a@.phx.gbl...
>>I have created the following table in Northwind Database:
>> CREATE TABLE #dts(c1 char(1), dt datetime)
>> INSERT INTO #dts (c1, dt) VALUES('a', '20040305 09:12:59')
>> INSERT INTO #dts (c1, dt) VALUES('b', '20040305 16:03:12')
>> INSERT INTO #dts (c1, dt) VALUES('c', '20040306 00:00:00')
>> INSERT INTO #dts (c1, dt) VALUES('d', '20040306 02:41:32')
>> INSERT INTO #dts (c1, dt) VALUES('e', '20040315 11:45:17')
>> INSERT INTO #dts (c1, dt) VALUES('f', '20040412 09:12:59')
>> INSERT INTO #dts (c1, dt) VALUES('g', '20040523 11:43:25')
>> However, when I search in both Northwind and Tempdb
>> databases, I am not able to find it. I would like to know
>> where is the Temporary Table being created ?
>> Thanks
>|||Why bother about the physical name? Just use the temp table name you gave it.
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
Blog: http://solidqualitylearning.com/blogs/tibor/
"Peter" <anonymous@.discussions.microsoft.com> wrote in message
news:0a0f01c56d8c$8f52e270$a401280a@.phx.gbl...
>I have created the following table in Northwind Database:
> CREATE TABLE #dts(c1 char(1), dt datetime)
> INSERT INTO #dts (c1, dt) VALUES('a', '20040305 09:12:59')
> INSERT INTO #dts (c1, dt) VALUES('b', '20040305 16:03:12')
> INSERT INTO #dts (c1, dt) VALUES('c', '20040306 00:00:00')
> INSERT INTO #dts (c1, dt) VALUES('d', '20040306 02:41:32')
> INSERT INTO #dts (c1, dt) VALUES('e', '20040315 11:45:17')
> INSERT INTO #dts (c1, dt) VALUES('f', '20040412 09:12:59')
> INSERT INTO #dts (c1, dt) VALUES('g', '20040523 11:43:25')
> However, when I search in both Northwind and Tempdb
> databases, I am not able to find it. I would like to know
> where is the Temporary Table being created ?
> Thanks|||Peter wrote:
> Dear Hari,
> I do find it by using your query.
> In this way, if I want to make query of that temporary table, should I use
> the table name dts?
Why not use the temp name (#dts)?
> Besides, you mention that temp tables are created every session, does it
> mean that it will be deleted automatically at a specific time ? If yes, when
> (Like - When I stop SQL Service) ?
>
The table will be dropped as soon as the connection is closed.
Are you trying to access this table from a different connection?
If so, you might want a global temp as already specified ##TableName.
This should be available until the service is restarted.
The beauty of temp tables is they are localized to your current
connection so you can use them in a sp for instance and guarantee that
nothing else will disturb your temp table.
You might well be able to query the name from tempdb and then use it
'normally' but this would defeat the purpose of temp tables and could
well introduce some nasty side effects.
Cheers
JB
> Thanks
> "Hari Prasad" <hari_prasad_k@.hotmail.com> wrote in message
> news:eA7wxCZbFHA.3712@.TK2MSFTNGP09.phx.gbl...
>>Hi,
>>All the # (temp) tables and ## (global temp) table will be created in
>>TEMPDB database. But for temp tables the name will be
>>created with a unique prefix. This is because temp tables are created
>>every session and each session a unqie table needs to be created.
>>How to see this..
>>Select name from tempdb..sysobjects where name like 'dts%'
>>Thanks
>>Hari
>>SQL Server MVP
>>
>>"Peter" <anonymous@.discussions.microsoft.com> wrote in message
>>news:0a0f01c56d8c$8f52e270$a401280a@.phx.gbl...
>>I have created the following table in Northwind Database:
>>CREATE TABLE #dts(c1 char(1), dt datetime)
>>INSERT INTO #dts (c1, dt) VALUES('a', '20040305 09:12:59')
>>INSERT INTO #dts (c1, dt) VALUES('b', '20040305 16:03:12')
>>INSERT INTO #dts (c1, dt) VALUES('c', '20040306 00:00:00')
>>INSERT INTO #dts (c1, dt) VALUES('d', '20040306 02:41:32')
>>INSERT INTO #dts (c1, dt) VALUES('e', '20040315 11:45:17')
>>INSERT INTO #dts (c1, dt) VALUES('f', '20040412 09:12:59')
>>INSERT INTO #dts (c1, dt) VALUES('g', '20040523 11:43:25')
>>However, when I search in both Northwind and Tempdb
>>databases, I am not able to find it. I would like to know
>>where is the Temporary Table being created ?
>>Thanks
>>
>

Monday, March 12, 2012

Localizing Time

Does Reporting Services provide any facilities for localizing DateTime
values based on the location of the server itself? We have DateTime values
stored in the database, and need them displayed converted to local time
where the server is located.
Thanks,
JasYou have access to all of the date/time manipulation functions of VB.Net
(http://msdn.microsoft.com/library/en-us/cpref/html/frlrfSystemDateTimeClass
Topic.asp) so you should be able to do whatever conversions are appropriate
for your application.
--
This post is provided 'AS IS' with no warranties, and confers no rights. All
rights reserved. Some assembly required. Batteries not included. Your
mileage may vary. Objects in mirror may be closer than they appear. No user
serviceable parts inside. Opening cover voids warranty. Keep out of reach of
children under 3.
"J Smith" <rs-nntp@.jascentral.com> wrote in message
news:ePM9MzGkEHA.3160@.TK2MSFTNGP10.phx.gbl...
> Does Reporting Services provide any facilities for localizing DateTime
> values based on the location of the server itself? We have DateTime
values
> stored in the database, and need them displayed converted to local time
> where the server is located.
> Thanks,
> Jas
>

Localization problem

Hi
I have a report with a "Jump to report" navigation field to a second report
, some of the parameters to the second report are DateTime values, when my
Local Settings are setted to English (United States) the link works fine,
but when I change my Local Settings to Spanish I get a Type Mismatch
message for this DateTime parameters. The "Language" property of both
reports are "Default", and when I execute by my self the second report
specifying each parameter with the correct locale datetime format it works
fine.
Any idea?
Thanksthis could happend because of session/caching of the subreport.
Click "Refresh" button on the toolbar when viewing the subreport.
--
This posting is provided "AS IS" with no warranties, and confers no rights.
"Mauricio Cadima" <mcadima@.jalasoft.com> wrote in message
news:uqK6c$2mEHA.404@.TK2MSFTNGP12.phx.gbl...
> Hi
> I have a report with a "Jump to report" navigation field to a second
> report
> , some of the parameters to the second report are DateTime values, when my
> Local Settings are setted to English (United States) the link works fine,
> but when I change my Local Settings to Spanish I get a Type Mismatch
> message for this DateTime parameters. The "Language" property of both
> reports are "Default", and when I execute by my self the second report
> specifying each parameter with the correct locale datetime format it works
> fine.
> Any idea?
> Thanks
>|||Thanks for your answer, but I think that is not the problem.
Let me explain the problem again, I have a first report with two parameters,
"Start Date" and "End Date" that are used when the report is executed to get
some information from some DB for this time range, this information is
showed in a table where the first column values are links to other report
(not a subrerport), this second report also uses date range parameters and
its values should be the same of the first report parameters, this means
that also should be specified in the link.
So when I click the link to open the second report and I have Spanish or
other locale selected for my system regional options a type mismatch message
is showed instead of the second report:
"The value provided for the report parameter 'EndDate' is not valid for its
type. (rsReportParameterTypeMismatch)"
My intuition is that the problem is with the date format, the date format
for Spanish locales is 'dd/mm/yyyy' and for english locale 'mm/dd/yyyy' I
think that the second report is trying to build its date time parameters
with the English locale and here is where the exception is raised. E.g. set
a value greater than 12 as month.
When I execute the second report specifying the parameters values manually
with the correct locale date format the report is showed without problems.
When I see the "Language" property of both reports in design mode is set to
default, I suppose that means that the report should works with the system
locale settings and use the correct date formats.
Thanks
Mauricio
"Lev Semenets [MSFT]" <levs@.microsoft.com> wrote in message
news:e8ju$c4mEHA.648@.tk2msftngp13.phx.gbl...
> this could happend because of session/caching of the subreport.
> Click "Refresh" button on the toolbar when viewing the subreport.
> --
> This posting is provided "AS IS" with no warranties, and confers no
rights.
>
> "Mauricio Cadima" <mcadima@.jalasoft.com> wrote in message
> news:uqK6c$2mEHA.404@.TK2MSFTNGP12.phx.gbl...
> > Hi
> > I have a report with a "Jump to report" navigation field to a second
> > report
> > , some of the parameters to the second report are DateTime values, when
my
> > Local Settings are setted to English (United States) the link works
fine,
> > but when I change my Local Settings to Spanish I get a Type Mismatch
> > message for this DateTime parameters. The "Language" property of both
> > reports are "Default", and when I execute by my self the second report
> > specifying each parameter with the correct locale datetime format it
works
> > fine.
> > Any idea?
> > Thanks
> >
> >
>|||What are parameters values that you pass to second report? What do you put
into Parameter Value cell of Parameters dialog?
--
This posting is provided "AS IS" with no warranties, and confers no rights.
"Mauricio Cadima" <mcadima@.jalasoft.com> wrote in message
news:%23HlTA0AnEHA.3196@.TK2MSFTNGP10.phx.gbl...
> Thanks for your answer, but I think that is not the problem.
>
> Let me explain the problem again, I have a first report with two
> parameters,
> "Start Date" and "End Date" that are used when the report is executed to
> get
> some information from some DB for this time range, this information is
> showed in a table where the first column values are links to other report
> (not a subrerport), this second report also uses date range parameters and
> its values should be the same of the first report parameters, this means
> that also should be specified in the link.
>
> So when I click the link to open the second report and I have Spanish or
> other locale selected for my system regional options a type mismatch
> message
> is showed instead of the second report:
>
> "The value provided for the report parameter 'EndDate' is not valid for
> its
> type. (rsReportParameterTypeMismatch)"
>
> My intuition is that the problem is with the date format, the date format
> for Spanish locales is 'dd/mm/yyyy' and for english locale 'mm/dd/yyyy' I
> think that the second report is trying to build its date time parameters
> with the English locale and here is where the exception is raised. E.g.
> set
> a value greater than 12 as month.
>
> When I execute the second report specifying the parameters values manually
> with the correct locale date format the report is showed without problems.
> When I see the "Language" property of both reports in design mode is set
> to
> default, I suppose that means that the report should works with the system
> locale settings and use the correct date formats.
>
> Thanks
> Mauricio
>
> "Lev Semenets [MSFT]" <levs@.microsoft.com> wrote in message
> news:e8ju$c4mEHA.648@.tk2msftngp13.phx.gbl...
>> this could happend because of session/caching of the subreport.
>> Click "Refresh" button on the toolbar when viewing the subreport.
>> --
>> This posting is provided "AS IS" with no warranties, and confers no
> rights.
>>
>> "Mauricio Cadima" <mcadima@.jalasoft.com> wrote in message
>> news:uqK6c$2mEHA.404@.TK2MSFTNGP12.phx.gbl...
>> > Hi
>> > I have a report with a "Jump to report" navigation field to a second
>> > report
>> > , some of the parameters to the second report are DateTime values, when
> my
>> > Local Settings are setted to English (United States) the link works
> fine,
>> > but when I change my Local Settings to Spanish I get a Type Mismatch
>> > message for this DateTime parameters. The "Language" property of both
>> > reports are "Default", and when I execute by my self the second report
>> > specifying each parameter with the correct locale datetime format it
> works
>> > fine.
>> > Any idea?
>> > Thanks
>> >
>> >
>>
>|||The same values of the first report parameters:
Parameter Name Parameter Value
StartDate =Parameters!StartDate.Value
EndDate =Parameters!EndDate.Value
"Lev Semenets [MSFT]" <levs@.microsoft.com> wrote in message
news:%23uc293FnEHA.3452@.TK2MSFTNGP15.phx.gbl...
> What are parameters values that you pass to second report? What do you put
> into Parameter Value cell of Parameters dialog?
> --
> This posting is provided "AS IS" with no warranties, and confers no
rights.
> "Mauricio Cadima" <mcadima@.jalasoft.com> wrote in message
> news:%23HlTA0AnEHA.3196@.TK2MSFTNGP10.phx.gbl...
> > Thanks for your answer, but I think that is not the problem.
> >
> >
> >
> > Let me explain the problem again, I have a first report with two
> > parameters,
> > "Start Date" and "End Date" that are used when the report is executed to
> > get
> > some information from some DB for this time range, this information is
> > showed in a table where the first column values are links to other
report
> > (not a subrerport), this second report also uses date range parameters
and
> > its values should be the same of the first report parameters, this means
> > that also should be specified in the link.
> >
> >
> >
> > So when I click the link to open the second report and I have Spanish or
> > other locale selected for my system regional options a type mismatch
> > message
> > is showed instead of the second report:
> >
> >
> >
> > "The value provided for the report parameter 'EndDate' is not valid for
> > its
> > type. (rsReportParameterTypeMismatch)"
> >
> >
> >
> > My intuition is that the problem is with the date format, the date
format
> > for Spanish locales is 'dd/mm/yyyy' and for english locale 'mm/dd/yyyy'
I
> > think that the second report is trying to build its date time parameters
> > with the English locale and here is where the exception is raised. E.g.
> > set
> > a value greater than 12 as month.
> >
> >
> >
> > When I execute the second report specifying the parameters values
manually
> > with the correct locale date format the report is showed without
problems.
> > When I see the "Language" property of both reports in design mode is set
> > to
> > default, I suppose that means that the report should works with the
system
> > locale settings and use the correct date formats.
> >
> >
> >
> > Thanks
> >
> > Mauricio
> >
> >
> >
> > "Lev Semenets [MSFT]" <levs@.microsoft.com> wrote in message
> > news:e8ju$c4mEHA.648@.tk2msftngp13.phx.gbl...
> >> this could happend because of session/caching of the subreport.
> >> Click "Refresh" button on the toolbar when viewing the subreport.
> >>
> >> --
> >> This posting is provided "AS IS" with no warranties, and confers no
> > rights.
> >>
> >>
> >> "Mauricio Cadima" <mcadima@.jalasoft.com> wrote in message
> >> news:uqK6c$2mEHA.404@.TK2MSFTNGP12.phx.gbl...
> >> > Hi
> >> > I have a report with a "Jump to report" navigation field to a second
> >> > report
> >> > , some of the parameters to the second report are DateTime values,
when
> > my
> >> > Local Settings are setted to English (United States) the link works
> > fine,
> >> > but when I change my Local Settings to Spanish I get a Type Mismatch
> >> > message for this DateTime parameters. The "Language" property of both
> >> > reports are "Default", and when I execute by my self the second
report
> >> > specifying each parameter with the correct locale datetime format it
> > works
> >> > fine.
> >> > Any idea?
> >> > Thanks
> >> >
> >> >
> >>
> >>
> >
> >
>|||I have having the very same problem. Did you ever solve this? And how
if you did?!
Thanks|||I have this problem as well, even though my report language is set to English
(United Kingdom), my Asp.Net app that calls the reporting service web service
is using en-GB as culture. It still thinks that my parameter End Date should
be in mm/dd/yyyy format and pukes when it sees something like 14/12/2004
(December 14, 2004) come over.
"Gearoid" wrote:
> I have having the very same problem. Did you ever solve this? And how
> if you did?!
> Thanks
>|||Adam,
Check the "Language Settings" for your browser.
Open IE, goto Tools->Internet Options->Click 'Languages...' button on the
General tab. Check that your language is English (United Kingdom)
I have got MSRS to work fine with UK English format dates... apart from
when reports are linked using 'Jump to' action.
Joe
"AdamB" wrote:
> I have this problem as well, even though my report language is set to English
> (United Kingdom), my Asp.Net app that calls the reporting service web service
> is using en-GB as culture. It still thinks that my parameter End Date should
> be in mm/dd/yyyy format and pukes when it sees something like 14/12/2004
> (December 14, 2004) come over.
> "Gearoid" wrote:
> > I have having the very same problem. Did you ever solve this? And how
> > if you did?!
> >
> > Thanks
> >
> >|||Try this and see if it works
Parameter Name Parameter Value
StartDate =Format(Parameters!StartDate.Value,
"dd-MMMM-yyyy")
EndDate =Format(Parameters!EndDate.Value,
"dd-MMMM-yyyy")
Cheers,
Harry
"Mauricio Cadima" wrote:
> The same values of the first report parameters:
> Parameter Name Parameter Value
> StartDate =Parameters!StartDate.Value
> EndDate =Parameters!EndDate.Value
> "Lev Semenets [MSFT]" <levs@.microsoft.com> wrote in message
> news:%23uc293FnEHA.3452@.TK2MSFTNGP15.phx.gbl...
> > What are parameters values that you pass to second report? What do you put
> > into Parameter Value cell of Parameters dialog?
> >
> > --
> > This posting is provided "AS IS" with no warranties, and confers no
> rights.
> >
> > "Mauricio Cadima" <mcadima@.jalasoft.com> wrote in message
> > news:%23HlTA0AnEHA.3196@.TK2MSFTNGP10.phx.gbl...
> > > Thanks for your answer, but I think that is not the problem.
> > >
> > >
> > >
> > > Let me explain the problem again, I have a first report with two
> > > parameters,
> > > "Start Date" and "End Date" that are used when the report is executed to
> > > get
> > > some information from some DB for this time range, this information is
> > > showed in a table where the first column values are links to other
> report
> > > (not a subrerport), this second report also uses date range parameters
> and
> > > its values should be the same of the first report parameters, this means
> > > that also should be specified in the link.
> > >
> > >
> > >
> > > So when I click the link to open the second report and I have Spanish or
> > > other locale selected for my system regional options a type mismatch
> > > message
> > > is showed instead of the second report:
> > >
> > >
> > >
> > > "The value provided for the report parameter 'EndDate' is not valid for
> > > its
> > > type. (rsReportParameterTypeMismatch)"
> > >
> > >
> > >
> > > My intuition is that the problem is with the date format, the date
> format
> > > for Spanish locales is 'dd/mm/yyyy' and for english locale 'mm/dd/yyyy'
> I
> > > think that the second report is trying to build its date time parameters
> > > with the English locale and here is where the exception is raised. E.g.
> > > set
> > > a value greater than 12 as month.
> > >
> > >
> > >
> > > When I execute the second report specifying the parameters values
> manually
> > > with the correct locale date format the report is showed without
> problems.
> > > When I see the "Language" property of both reports in design mode is set
> > > to
> > > default, I suppose that means that the report should works with the
> system
> > > locale settings and use the correct date formats.
> > >
> > >
> > >
> > > Thanks
> > >
> > > Mauricio
> > >
> > >
> > >
> > > "Lev Semenets [MSFT]" <levs@.microsoft.com> wrote in message
> > > news:e8ju$c4mEHA.648@.tk2msftngp13.phx.gbl...
> > >> this could happend because of session/caching of the subreport.
> > >> Click "Refresh" button on the toolbar when viewing the subreport.
> > >>
> > >> --
> > >> This posting is provided "AS IS" with no warranties, and confers no
> > > rights.
> > >>
> > >>
> > >> "Mauricio Cadima" <mcadima@.jalasoft.com> wrote in message
> > >> news:uqK6c$2mEHA.404@.TK2MSFTNGP12.phx.gbl...
> > >> > Hi
> > >> > I have a report with a "Jump to report" navigation field to a second
> > >> > report
> > >> > , some of the parameters to the second report are DateTime values,
> when
> > > my
> > >> > Local Settings are setted to English (United States) the link works
> > > fine,
> > >> > but when I change my Local Settings to Spanish I get a Type Mismatch
> > >> > message for this DateTime parameters. The "Language" property of both
> > >> > reports are "Default", and when I execute by my self the second
> report
> > >> > specifying each parameter with the correct locale datetime format it
> > > works
> > >> > fine.
> > >> > Any idea?
> > >> > Thanks
> > >> >
> > >> >
> > >>
> > >>
> > >
> > >
> >
> >
>
>

Friday, March 9, 2012

Local table and OpenQuery

I created a stored procedure like this:

CREATE PROCEDURE SP
AS
BEGIN
CREATE TABLE #T( C INT )
INSERT INTO #T(C) VALUES (1)
SELECT * FROM #T
END

When I call it this way: EXEC SP, it works ok.

But when I do it like this:
SELECT * FROM OPENQUERY( MYSERVER, 'EXEC SP')
I receive an error: Invalid object name '#T'
Why?...

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!Evgeny Gopengauz <evgop@.ucs.ru> wrote in message news:<4119d7ae$0$14493$c397aba@.news.newsgroups.ws>...
> I created a stored procedure like this:
> CREATE PROCEDURE SP
> AS
> BEGIN
> CREATE TABLE #T( C INT )
> INSERT INTO #T(C) VALUES (1)
> SELECT * FROM #T
> END
> When I call it this way: EXEC SP, it works ok.
> But when I do it like this:
> SELECT * FROM OPENQUERY( MYSERVER, 'EXEC SP')
> I receive an error: Invalid object name '#T'
> Why?...
> *** Sent via Developersdex http://www.developersdex.com ***
> Don't just participate in USENET...get rewarded for it!

It looks like this is another multi-posted question - if you want
feedback from different groups, then please post to all of them at
once with a single posting. Having said that, you might find Erland's
recent explanation in another thread useful:

http://groups.google.com/groups?hl=...es.ms-sqlserver

Also, if you are trying to do something with the output of a stored
procedure, this article (also from Erland) should point you in the
right direction:

http://www.sommarskog.se/share_data.html

Simon|||Simon! Thank you for your references, I just found the accurate solution
for my troubles.

Concerning with my mutli-posting... I'm sorry but I have no an ability
to post to the comp.databases.ms-sqlserver and
microsoft.public.sqlserver.programming simultaneously (at the same
message) because this conference is available for me through
www.developersdex.com, but microsoft.public through NNTP. Excuse me
please, hope it will never happen again, I will use a single conference
for each single quiestion.

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!