Wednesday, March 28, 2012
How odd, strange behaviour
I've got the following issue and I can't work out:
This statement fails:
SELECT G61Num AS Curso,G61FORM AS Dni,'F' AS Tipo
FROM srvdesa2.NOM.DBO.G61DIET WITH (NOLOCK)
Servidor: mensaje 7377, nivel 16, estado 1, l_nea 2
Cannot specify an index or locking hint for a remote data source.
But this one, ends successful and pull up the data:
SELECT G61Num AS Curso,G61FORM AS Dni,'F' AS Tipo
FROM srvdesa2.NOM.DBO.G61DIET NOLOCK
Does anyone ever used or experienced any problem with that? are we talking
about the same or different goal with the different way? I mean, nolock, wit
h
nolock...
Thanks for any input and regards,You are defining just an alias here:
SELECT G61Num AS Curso,G61FORM AS Dni,'F' AS Tipo
FROM srvdesa2.NOM.DBO.G61DIET NOLOCK
Something like SELECT G61Num AS Curso,G61FORM AS Dni,'F' AS Tipo
FROM srvdesa2.NOM.DBO.G61DIET SomeAlias
HTH, Jens Suessmeyer.|||sorry Jens, I don't understand you, what do you mean with that?
"Jens" wrote:
> You are defining just an alias here:
> SELECT G61Num AS Curso,G61FORM AS Dni,'F' AS Tipo
> FROM srvdesa2.NOM.DBO.G61DIET NOLOCK
>
> Something like SELECT G61Num AS Curso,G61FORM AS Dni,'F' AS Tipo
> FROM srvdesa2.NOM.DBO.G61DIET SomeAlias
>
> HTH, Jens Suessmeyer.
>|||Defining aliases for the tables often helps to clear queries due to
long names or names where you don=B4t know what the data is all about,
something like:
SELECT Address.*
FROM T3455NBGA Address --Normally this is an Adress table but you
don=B4t know from the name, so we give it an alias in the query
INNER JOIN SomeOtherTable
ON SOmeotherTable.ID =3D Address.ID
HTH, Jens Suessmeyer.|||Thanks in advance, anyway it doesn't works.
"Jens" wrote:
> Defining aliases for the tables often helps to clear queries due to
> long names or names where you don′t know what the data is all about,
> something like:
> SELECT Address.*
> FROM T3455NBGA Address --Normally this is an Adress table but you
> don′t know from the name, so we give it an alias in the query
> INNER JOIN SomeOtherTable
> ON SOmeotherTable.ID = Address.ID
> HTH, Jens Suessmeyer.
>|||> But this one, ends successful and pull up the data:
> SELECT G61Num AS Curso,G61FORM AS Dni,'F' AS Tipo
> FROM srvdesa2.NOM.DBO.G61DIET NOLOCK
So will this:
> SELECT NOLOCK.G61Num AS Curso,NOLOCK.G61FORM AS Dni,'F' AS Tipo
> FROM srvdesa2.NOM.DBO.G61DIET NOLOCK
And this:
> SELECT bozo.G61Num AS Curso,bozo.G61FORM AS Dni,'F' AS Tipo
> FROM srvdesa2.NOM.DBO.G61DIET bozo
You would think that SQL Server would treat 'NOLOCK' as a reserved word, but
it doesn't.
"Enric" <Enric@.discussions.microsoft.com> wrote in message
news:95D4CF5F-8E45-44E4-9F35-95F38A5286DA@.microsoft.com...
> Dear folks,
> I've got the following issue and I can't work out:
> This statement fails:
> SELECT G61Num AS Curso,G61FORM AS Dni,'F' AS Tipo
> FROM srvdesa2.NOM.DBO.G61DIET WITH (NOLOCK)
>
> Servidor: mensaje 7377, nivel 16, estado 1, lnea 2
> Cannot specify an index or locking hint for a remote data source.
> But this one, ends successful and pull up the data:
> SELECT G61Num AS Curso,G61FORM AS Dni,'F' AS Tipo
> FROM srvdesa2.NOM.DBO.G61DIET NOLOCK
> Does anyone ever used or experienced any problem with that? are we talking
> about the same or different goal with the different way? I mean, nolock,
> with
> nolock...
> Thanks for any input and regards,|||Of course not. Because of how you placed NOLOCK in your code, it is simply
being used as an alternative table name, instead of the NOLOCK action that
you are trying to produce. The query that is working is not using NOLOCK as
you intend, but rather is using the term as a reference to your table. The
query that is failing is using NOLOCK as you intended, but SQL Server does
not permit you to use it in that context.
"Enric" <Enric@.discussions.microsoft.com> wrote in message
news:5A50B17C-2705-4027-A5F6-24E025F0CD4F@.microsoft.com...
> Thanks in advance, anyway it doesn't works.
> "Jens" wrote:
>|||I should add that this is not your fault (IMO) since it is more than
reasonable to expect NOLOCK to be a reserved word. It is a simple syntax
error, and an honest mistake.
"Jim Underwood" <james.underwoodATfallonclinic.com> wrote in message
news:%23PJDYbnJGHA.1728@.TK2MSFTNGP09.phx.gbl...
> Of course not. Because of how you placed NOLOCK in your code, it is
simply
> being used as an alternative table name, instead of the NOLOCK action that
> you are trying to produce. The query that is working is not using NOLOCK
as
> you intend, but rather is using the term as a reference to your table.
The
> query that is failing is using NOLOCK as you intended, but SQL Server does
> not permit you to use it in that context.
Friday, March 9, 2012
How know when one Table was droped? HELP-ME
I have one Data Base,
Today one strange thing occur, one table of my data base disappear , I didnt
drop it, then i would like know if have way to determine when this occur;
The last week same thing occur whit one store procedure.
Any one knows, how to help-me.
I use SQL Server 2005 SP1
Thanks to allIn SQL Server 2005 you can use DDL Triggers. Using these triggers you can
record the time the object was deleted, the login and user name used to
delete the object and the command executed, among other things.
See BOL for more information.
Ben Nevarez, MCDBA, OCP
Database Administrator
"retf" wrote:
> Hi all,
> I have one Data Base,
> Today one strange thing occur, one table of my data base disappear , I didnt
> drop it, then i would like know if have way to determine when this occur;
> The last week same thing occur whit one store procedure.
>
> Any one knows, how to help-me.
> I use SQL Server 2005 SP1
> Thanks to all
>
>
>|||Hi
It sounds like you may need to review your security settings and who has
access to this system! If this is a development system then you should also
be keeping code in a version control system.
John
"retf" wrote:
> Hi all,
> I have one Data Base,
> Today one strange thing occur, one table of my data base disappear , I didnt
> drop it, then i would like know if have way to determine when this occur;
> The last week same thing occur whit one store procedure.
>
> Any one knows, how to help-me.
> I use SQL Server 2005 SP1
> Thanks to all
>
>
>
How know when one Table was droped? HELP-ME
I have one Data Base,
Today one strange thing occur, one table of my data base disappear , I didnt
drop it, then i would like know if have way to determine when this occur;
The last week same thing occur whit one store procedure.
Any one knows, how to help-me.
I use SQL Server 2005 SP1
Thanks to all"retf" <re.tf@.terra.com.br> wrote in message
news:eZ59$B5eGHA.2076@.TK2MSFTNGP04.phx.gbl...
> Hi all,
> I have one Data Base,
> Today one strange thing occur, one table of my data base disappear , I
> didnt
> drop it, then i would like know if have way to determine when this occur;
> The last week same thing occur whit one store procedure.
>
> Any one knows, how to help-me.
> I use SQL Server 2005 SP1
>
Look at the schema change history report in Management Studio.
David|||Where I find this?
Thanks for the help.
"David Browne" <davidbaxterbrowne no potted meat@.hotmail.com> escreveu na
mensagem news:%23k73bO5eGHA.1260@.TK2MSFTNGP05.phx.gbl...
> "retf" <re.tf@.terra.com.br> wrote in message
> news:eZ59$B5eGHA.2076@.TK2MSFTNGP04.phx.gbl...
>> Hi all,
>> I have one Data Base,
>> Today one strange thing occur, one table of my data base disappear , I
>> didnt
>> drop it, then i would like know if have way to determine when this
>> occur;
>> The last week same thing occur whit one store procedure.
>>
>> Any one knows, how to help-me.
>> I use SQL Server 2005 SP1
>
> Look at the schema change history report in Management Studio.
> David
>|||SS Management Studio, Summary Tab, Report, Schema Changes History.
Ben Nevarez, MCDBA, OCP
Database Administrator
"retf" wrote:
> Where I find this?
> Thanks for the help.
> "David Browne" <davidbaxterbrowne no potted meat@.hotmail.com> escreveu na
> mensagem news:%23k73bO5eGHA.1260@.TK2MSFTNGP05.phx.gbl...
> >
> > "retf" <re.tf@.terra.com.br> wrote in message
> > news:eZ59$B5eGHA.2076@.TK2MSFTNGP04.phx.gbl...
> >> Hi all,
> >>
> >> I have one Data Base,
> >>
> >> Today one strange thing occur, one table of my data base disappear , I
> >> didnt
> >> drop it, then i would like know if have way to determine when this
> >> occur;
> >>
> >> The last week same thing occur whit one store procedure.
> >>
> >>
> >> Any one knows, how to help-me.
> >>
> >> I use SQL Server 2005 SP1
> >>
> >
> >
> > Look at the schema change history report in Management Studio.
> >
> > David
> >
>
>|||Hi,
Thank you very much...:o) :o) :o) :o)
"Ben Nevarez" <bnevarez@.sjm.com> escreveu na mensagem
news:54A60353-0816-4335-839F-50D6682BFFB4@.microsoft.com...
> SS Management Studio, Summary Tab, Report, Schema Changes History.
> Ben Nevarez, MCDBA, OCP
> Database Administrator
>
> "retf" wrote:
>> Where I find this?
>> Thanks for the help.
>> "David Browne" <davidbaxterbrowne no potted meat@.hotmail.com> escreveu na
>> mensagem news:%23k73bO5eGHA.1260@.TK2MSFTNGP05.phx.gbl...
>> >
>> > "retf" <re.tf@.terra.com.br> wrote in message
>> > news:eZ59$B5eGHA.2076@.TK2MSFTNGP04.phx.gbl...
>> >> Hi all,
>> >>
>> >> I have one Data Base,
>> >>
>> >> Today one strange thing occur, one table of my data base disappear , I
>> >> didnt
>> >> drop it, then i would like know if have way to determine when this
>> >> occur;
>> >>
>> >> The last week same thing occur whit one store procedure.
>> >>
>> >>
>> >> Any one knows, how to help-me.
>> >>
>> >> I use SQL Server 2005 SP1
>> >>
>> >
>> >
>> > Look at the schema change history report in Management Studio.
>> >
>> > David
>> >
>>
How know when one Table was droped? HELP-ME
I have one Data Base,
Today one strange thing occur, one table of my data base disappear , I didnt
drop it, then i would like know if have way to determine when this occur;
The last w
Any one knows, how to help-me.
I use SQL Server 2005 SP1
Thanks to allyou can have a DDL trigger defined for DROP objects.. Don't know the exact
syntax..
you can check the BOL..
In this DDL trigger you can select the event details and insert it to a
table.|||You can DDL trigger for logging and Event Notification in S2K5.
"Retf"?? ??? ??:
> Hi all,
> I have one Data Base,
> Today one strange thing occur, one table of my data base disappear , I did
nt
> drop it, then i would like know if have way to determine when this occur;
> The last w
>
> Any one knows, how to help-me.
> I use SQL Server 2005 SP1
> Thanks to all
>
>|||SQL Server 2005 has an always running trace - called "default trace". All ob
ject drop/alter/creation is audited (among other things). It keeps the histo
ry in up to 5 separate trace files with a limit of 20 MB per file. Since on
every SQL server restart a
new file is created the history is limited also by the last 5 SQL Server res
tarts. Here is how to get the information (assuming you have the default fil
e layout):
SELECT * FROM fn_trace_gettable
('C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\LOG\log.trc', default)
If you have lots of trace files under your LOG folder, find the last bunch o
f continuous file numbers and use the first file number. For instance if you
see log_154.trc, log_155.trc, log_156.trc, log_157.trc, use:
SELECT * FROM fn_trace_gettable
('C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\LOG\log_154.trc', defa
ult)
Thanks,
-Ivan
--Original Message--
From: hongjujung
Posted At: Friday, May 19, 2006 10:21 PM
Posted To: microsoft.public.sqlserver.programming
Conversation: How know when one Table was droped? HELP-ME
Subject: RE: How know when one Table was droped? HELP-ME
You can DDL trigger for logging and Event Notification in S2K5.
"Retf"?? ??? ??:
> Hi all,
> I have one Data Base,
> Today one strange thing occur, one table of my data base disappear , I
> didnt drop it, then i would like know if have way to determine when
> this occur;
> The last w
>
> Any one knows, how to help-me.
> I use SQL Server 2005 SP1
> Thanks to all
>
>
How know when one Table was droped? HELP-ME
I have one Data Base,
Today one strange thing occur, one table of my data base disappear , I didnt
drop it, then i would like know if have way to determine when this occur;
The last week same thing occur whit one store procedure.
Any one knows, how to help-me.
I use SQL Server 2005 SP1
Thanks to all"retf" <re.tf@.terra.com.br> wrote in message
news:eZ59$B5eGHA.2076@.TK2MSFTNGP04.phx.gbl...
> Hi all,
> I have one Data Base,
> Today one strange thing occur, one table of my data base disappear , I
> didnt
> drop it, then i would like know if have way to determine when this occur;
> The last week same thing occur whit one store procedure.
>
> Any one knows, how to help-me.
> I use SQL Server 2005 SP1
>
Look at the schema change history report in Management Studio.
David|||Where I find this?
Thanks for the help.
"David Browne" <davidbaxterbrowne no potted meat@.hotmail.com> escreveu na
mensagem news:%23k73bO5eGHA.1260@.TK2MSFTNGP05.phx.gbl...
> "retf" <re.tf@.terra.com.br> wrote in message
> news:eZ59$B5eGHA.2076@.TK2MSFTNGP04.phx.gbl...
>
> Look at the schema change history report in Management Studio.
> David
>|||SS Management Studio, Summary Tab, Report, Schema Changes History.
Ben Nevarez, MCDBA, OCP
Database Administrator
"retf" wrote:
> Where I find this?
> Thanks for the help.
> "David Browne" <davidbaxterbrowne no potted meat@.hotmail.com> escreveu na
> mensagem news:%23k73bO5eGHA.1260@.TK2MSFTNGP05.phx.gbl...
>
>|||Hi,
Thank you very much...:o) :o) :o) :o)
"Ben Nevarez" <bnevarez@.sjm.com> escreveu na mensagem
news:54A60353-0816-4335-839F-50D6682BFFB4@.microsoft.com...[vbcol=seagreen]
> SS Management Studio, Summary Tab, Report, Schema Changes History.
> Ben Nevarez, MCDBA, OCP
> Database Administrator
>
> "retf" wrote:
>
How know when one Table was droped? HELP-ME
I have one Data Base,
Today one strange thing occur, one table of my data base disappear , I didnt
drop it, then i would like know if have way to determine when this occur;
The last week same thing occur whit one store procedure.
Any one knows, how to help-me.
I use SQL Server 2005 SP1
Thanks to allIn SQL Server 2005 you can use DDL Triggers. Using these triggers you can
record the time the object was deleted, the login and user name used to
delete the object and the command executed, among other things.
See BOL for more information.
Ben Nevarez, MCDBA, OCP
Database Administrator
"retf" wrote:
> Hi all,
> I have one Data Base,
> Today one strange thing occur, one table of my data base disappear , I did
nt
> drop it, then i would like know if have way to determine when this occur;
> The last week same thing occur whit one store procedure.
>
> Any one knows, how to help-me.
> I use SQL Server 2005 SP1
> Thanks to all
>
>
>|||Hi
It sounds like you may need to review your security settings and who has
access to this system! If this is a development system then you should also
be keeping code in a version control system.
John
"retf" wrote:
> Hi all,
> I have one Data Base,
> Today one strange thing occur, one table of my data base disappear , I did
nt
> drop it, then i would like know if have way to determine when this occur;
> The last week same thing occur whit one store procedure.
>
> Any one knows, how to help-me.
> I use SQL Server 2005 SP1
> Thanks to all
>
>
>
How is the metadata of the result of a UNION determined?
Hi,
A colleague and I have just found a slightly strange situation that we don't understand.
We had (effectively) the following query:
select cast(1 as decimal(38,10))
union all
select cast(1 as decimal(38,4))
And the result contained 2 rows, each with a a scale of 4. This surprised us, we expected that the metadata of the result would be determined by the topmost query.
So we reversed them and tried this:
select cast(1 as decimal(38,4))
union all
select cast(1 as decimal(38,10))
and got exactly the same result. 2 rows with a scale of 4.
We can't understand why the scale always gets determined to be 4 regardless of the order of the queries.
Any explanation would be much appreciated!
Thanks
Jamie
Doesn't matter. The answer's here: http://msdn2.microsoft.com/en-us/library/ms190476.aspx
-Jamie
|||In addition to the "Precision, scale and length" topic, the UNION operator topic also documents how the data conversions happens if the various SELECT statements contain columns with different data types. See link below for more details:
http://msdn2.microsoft.com/en-us/library/ms180026(SQL.90).aspx