Had something interesting happen yesterday.
Was given an alter table script to add two columns to a table we have. As
we use replication and I needed these two columns to replicate, I couldn't
simply use the alter table script but had to translate it into using
sp_repladdcolumn.
No, in the original script, it was: (and forgive typos, going on memory
here)
alter table table_foo
add column [target_object_cache_time] int not null default(0);
Now, if I create the column that way, it adds the column
target_object_cache_time.
However, when I used sp_repladdcolumn 'table_foo',
'[target_object_cache_time]', 'int not null deafult(0)';
it creates the columns with the [] around the name. i.e.
[target_object_cache_time] Moreover, it appeared to create it as
[target_object_cache_time]] on the subscribers.
Needless to say, when I tried to update the stored proc, which uses the new
column, it failed since it was looking for target_object_cache_time not
[target_object_cache_time].
Ok, not a big deal, I figure I'd issue a sp_repldropcolumn and recreate the
columns.
Here's the error message I recieved:
Category:COMMAND
Source: Failed Command
Number:
Message: if exists (select * from syscolumns where
name='[target_object_cache_time]'
and id = object_id('table_foo'))
begin if exists (select * from sysobjects where name='syspublications')
if exists (select * from sysarticles where objid=object_id('table_foo'))
and @.@.microsoftversion >= 0x07320000
exec sp_repldropcolumn
@.source_object=N'[table_foo]',@.column=N'[target_object_cache_time]'
else alter table [table_foo] drop column [[target_object_cache_t
ime]]] else
alter table [table_foo] drop column [[t
(it got cut off).
As you can see, sometimes it's treating it with an extra set of [] and
sometimes not.
It seems to me that sp_repladdcolumn should treat [] the same way as alt
er
table does. But even if it doesn't, it seems to me that you should be able
to drop the columns cleanly at least.
Thoughts? (I didn't really test too much reproduction since I was trying to
get the root problem fixed on our prod boxes at the time. :-)
If I get a chance, I may try to reproduce this again later if no one else
can.
--
Greg D. Moore
President Green Mountain Software
Personal: http://stratton.greenms.com
SQL Server Consulting sql at greenms.comGo to the Product Feedback Center and file it as a bug. It is using
brackets to ensure that there aren't any issues with spaces in the names.
Mike
http://www.solidqualitylearning.com
Disclaimer: This communication is an original work and represents my sole
views on the subject. It does not represent the views of any other person
or entity either by inference or direct reference.
"Greg D. Moore (Strider)" <mooregr_deleteth1s@.greenms.com> wrote in message
news:eHQ78PxYGHA.5012@.TK2MSFTNGP04.phx.gbl...
> Had something interesting happen yesterday.
> Was given an alter table script to add two columns to a table we have. As
> we use replication and I needed these two columns to replicate, I couldn't
> simply use the alter table script but had to translate it into using
> sp_repladdcolumn.
> No, in the original script, it was: (and forgive typos, going on memory
> here)
> alter table table_foo
> add column [target_object_cache_time] int not null default(0);
> Now, if I create the column that way, it adds the column
> target_object_cache_time.
> However, when I used sp_repladdcolumn 'table_foo',
> '[target_object_cache_time]', 'int not null deafult(0)';
> it creates the columns with the [] around the name. i.e.
> [target_object_cache_time] Moreover, it appeared to create it as
> [target_object_cache_time]] on the subscribers.
> Needless to say, when I tried to update the stored proc, which uses the
> new
> column, it failed since it was looking for target_object_cache_time not
> [target_object_cache_time].
> Ok, not a big deal, I figure I'd issue a sp_repldropcolumn and recreate
> the
> columns.
> Here's the error message I recieved:
> Category:COMMAND
> Source: Failed Command
> Number:
> Message: if exists (select * from syscolumns where
> name='[target_object_cache_time]'
> and id = object_id('table_foo'))
> begin if exists (select * from sysobjects where name='syspublications')
> if exists (select * from sysarticles where objid=object_id('table_foo'))
> and @.@.microsoftversion >= 0x07320000
> exec sp_repldropcolumn
> @.source_object=N'[table_foo]',@.column=N'[target_object_cache_time]
'
> else alter table [table_foo] drop column [[target_object_cache
_time]]]
> else
> alter table [table_foo] drop column [[t
> (it got cut off).
> As you can see, sometimes it's treating it with an extra set of [] and
> sometimes not.
> It seems to me that sp_repladdcolumn should treat [] the same way as a
lter
> table does. But even if it doesn't, it seems to me that you should be
> able
> to drop the columns cleanly at least.
> Thoughts? (I didn't really test too much reproduction since I was trying
> to
> get the root problem fixed on our prod boxes at the time. :-)
> If I get a chance, I may try to reproduce this again later if no one else
> can.
>
>
>
> --
> --
> Greg D. Moore
> President Green Mountain Software
> Personal: http://stratton.greenms.com
> SQL Server Consulting sql at greenms.com
>|||"Michael Hotek" <mike@.solidqualitylearning.com> wrote in message
news:%23D%23lFF8YGHA.500@.TK2MSFTNGP03.phx.gbl...
> Go to the Product Feedback Center and file it as a bug.
What's the specific URL?
> It is using
> brackets to ensure that there aren't any issues with spaces in the names.
Right, but besides using them wrongly, it's inconsistent in its use of them.
:-)
> --
> Mike
> http://www.solidqualitylearning.com
> Disclaimer: This communication is an original work and represents my sole
> views on the subject. It does not represent the views of any other person
> or entity either by inference or direct reference.
>
> "Greg D. Moore (Strider)" <mooregr_deleteth1s@.greenms.com> wrote in
message
> news:eHQ78PxYGHA.5012@.TK2MSFTNGP04.phx.gbl...
As[vbcol=seagreen]
couldn't[vbcol=seagreen]
alter[vbcol=seagreen]
trying[vbcol=seagreen]
else[vbcol=seagreen]
>|||Greg D. Moore (Strider) wrote:
>"Michael Hotek" <mike@.solidqualitylearning.com> wrote in message
>news:%23D%23lFF8YGHA.500@.TK2MSFTNGP03.phx.gbl...
>
>What's the specific URL?
>
http://lab.msdn.microsoft.com/produ...ck/default.aspx
*mike hodgson*
http://sqlnerd.blogspot.com
Showing posts with label interesting. Show all posts
Showing posts with label interesting. Show all posts
Saturday, February 25, 2012
Possible Bug in sp_repladdcolumn? (SQL 2000, SP4)
Had something interesting happen yesterday.
Was given an alter table script to add two columns to a table we have. As
we use replication and I needed these two columns to replicate, I couldn't
simply use the alter table script but had to translate it into using
sp_repladdcolumn.
No, in the original script, it was: (and forgive typos, going on memory
here)
alter table table_foo
add column [target_object_cache_time] int not null default(0);
Now, if I create the column that way, it adds the column
target_object_cache_time.
However, when I used sp_repladdcolumn 'table_foo',
'[target_object_cache_time]', 'int not null deafult(0)';
it creates the columns with the [] around the name. i.e.
[target_object_cache_time] Moreover, it appeared to create it as
[target_object_cache_time]] on the subscribers.
Needless to say, when I tried to update the stored proc, which uses the new
column, it failed since it was looking for target_object_cache_time not
[target_object_cache_time].
Ok, not a big deal, I figure I'd issue a sp_repldropcolumn and recreate the
columns.
Here's the error message I recieved:
Category:COMMAND
Source: Failed Command
Number:
Message: if exists (select * from syscolumns where
name='[target_object_cache_time]'
and id = object_id('table_foo'))
begin if exists (select * from sysobjects where name='syspublications')
if exists (select * from sysarticles where objid=object_id('table_foo'))
and @.@.microsoftversion >= 0x07320000
exec sp_repldropcolumn
@.source_object=N'[table_foo]',@.column=N'[target_object_cache_time]'
else alter table [table_foo] drop column [[target_object_cache_time]]] else
alter table [table_foo] drop column [[t
(it got cut off).
As you can see, sometimes it's treating it with an extra set of [] and
sometimes not.
It seems to me that sp_repladdcolumn should treat [] the same way as alter
table does. But even if it doesn't, it seems to me that you should be able
to drop the columns cleanly at least.
Thoughts? (I didn't really test too much reproduction since I was trying to
get the root problem fixed on our prod boxes at the time. :-)
If I get a chance, I may try to reproduce this again later if no one else
can.
--
--
Greg D. Moore
President Green Mountain Software
Personal: http://stratton.greenms.com
SQL Server Consulting sql at greenms.comGo to the Product Feedback Center and file it as a bug. It is using
brackets to ensure that there aren't any issues with spaces in the names.
--
Mike
http://www.solidqualitylearning.com
Disclaimer: This communication is an original work and represents my sole
views on the subject. It does not represent the views of any other person
or entity either by inference or direct reference.
"Greg D. Moore (Strider)" <mooregr_deleteth1s@.greenms.com> wrote in message
news:eHQ78PxYGHA.5012@.TK2MSFTNGP04.phx.gbl...
> Had something interesting happen yesterday.
> Was given an alter table script to add two columns to a table we have. As
> we use replication and I needed these two columns to replicate, I couldn't
> simply use the alter table script but had to translate it into using
> sp_repladdcolumn.
> No, in the original script, it was: (and forgive typos, going on memory
> here)
> alter table table_foo
> add column [target_object_cache_time] int not null default(0);
> Now, if I create the column that way, it adds the column
> target_object_cache_time.
> However, when I used sp_repladdcolumn 'table_foo',
> '[target_object_cache_time]', 'int not null deafult(0)';
> it creates the columns with the [] around the name. i.e.
> [target_object_cache_time] Moreover, it appeared to create it as
> [target_object_cache_time]] on the subscribers.
> Needless to say, when I tried to update the stored proc, which uses the
> new
> column, it failed since it was looking for target_object_cache_time not
> [target_object_cache_time].
> Ok, not a big deal, I figure I'd issue a sp_repldropcolumn and recreate
> the
> columns.
> Here's the error message I recieved:
> Category:COMMAND
> Source: Failed Command
> Number:
> Message: if exists (select * from syscolumns where
> name='[target_object_cache_time]'
> and id = object_id('table_foo'))
> begin if exists (select * from sysobjects where name='syspublications')
> if exists (select * from sysarticles where objid=object_id('table_foo'))
> and @.@.microsoftversion >= 0x07320000
> exec sp_repldropcolumn
> @.source_object=N'[table_foo]',@.column=N'[target_object_cache_time]'
> else alter table [table_foo] drop column [[target_object_cache_time]]]
> else
> alter table [table_foo] drop column [[t
> (it got cut off).
> As you can see, sometimes it's treating it with an extra set of [] and
> sometimes not.
> It seems to me that sp_repladdcolumn should treat [] the same way as alter
> table does. But even if it doesn't, it seems to me that you should be
> able
> to drop the columns cleanly at least.
> Thoughts? (I didn't really test too much reproduction since I was trying
> to
> get the root problem fixed on our prod boxes at the time. :-)
> If I get a chance, I may try to reproduce this again later if no one else
> can.
>
>
>
> --
> --
> Greg D. Moore
> President Green Mountain Software
> Personal: http://stratton.greenms.com
> SQL Server Consulting sql at greenms.com
>|||"Michael Hotek" <mike@.solidqualitylearning.com> wrote in message
news:%23D%23lFF8YGHA.500@.TK2MSFTNGP03.phx.gbl...
> Go to the Product Feedback Center and file it as a bug.
What's the specific URL?
> It is using
> brackets to ensure that there aren't any issues with spaces in the names.
Right, but besides using them wrongly, it's inconsistent in its use of them.
:-)
> --
> Mike
> http://www.solidqualitylearning.com
> Disclaimer: This communication is an original work and represents my sole
> views on the subject. It does not represent the views of any other person
> or entity either by inference or direct reference.
>
> "Greg D. Moore (Strider)" <mooregr_deleteth1s@.greenms.com> wrote in
message
> news:eHQ78PxYGHA.5012@.TK2MSFTNGP04.phx.gbl...
> >
> > Had something interesting happen yesterday.
> >
> > Was given an alter table script to add two columns to a table we have.
As
> > we use replication and I needed these two columns to replicate, I
couldn't
> > simply use the alter table script but had to translate it into using
> > sp_repladdcolumn.
> >
> > No, in the original script, it was: (and forgive typos, going on memory
> > here)
> >
> > alter table table_foo
> > add column [target_object_cache_time] int not null default(0);
> >
> > Now, if I create the column that way, it adds the column
> > target_object_cache_time.
> >
> > However, when I used sp_repladdcolumn 'table_foo',
> > '[target_object_cache_time]', 'int not null deafult(0)';
> >
> > it creates the columns with the [] around the name. i.e.
> > [target_object_cache_time] Moreover, it appeared to create it as
> > [target_object_cache_time]] on the subscribers.
> >
> > Needless to say, when I tried to update the stored proc, which uses the
> > new
> > column, it failed since it was looking for target_object_cache_time not
> > [target_object_cache_time].
> >
> > Ok, not a big deal, I figure I'd issue a sp_repldropcolumn and recreate
> > the
> > columns.
> >
> > Here's the error message I recieved:
> >
> > Category:COMMAND
> > Source: Failed Command
> > Number:
> > Message: if exists (select * from syscolumns where
> > name='[target_object_cache_time]'
> > and id = object_id('table_foo'))
> > begin if exists (select * from sysobjects where name='syspublications')
> > if exists (select * from sysarticles where objid=object_id('table_foo'))
> > and @.@.microsoftversion >= 0x07320000
> >
> > exec sp_repldropcolumn
> > @.source_object=N'[table_foo]',@.column=N'[target_object_cache_time]'
> > else alter table [table_foo] drop column [[target_object_cache_time]]]
> > else
> > alter table [table_foo] drop column [[t
> >
> > (it got cut off).
> >
> > As you can see, sometimes it's treating it with an extra set of [] and
> > sometimes not.
> >
> > It seems to me that sp_repladdcolumn should treat [] the same way as
alter
> > table does. But even if it doesn't, it seems to me that you should be
> > able
> > to drop the columns cleanly at least.
> >
> > Thoughts? (I didn't really test too much reproduction since I was
trying
> > to
> > get the root problem fixed on our prod boxes at the time. :-)
> >
> > If I get a chance, I may try to reproduce this again later if no one
else
> > can.
> >
> >
> >
> >
> >
> >
> > --
> > --
> > Greg D. Moore
> > President Green Mountain Software
> > Personal: http://stratton.greenms.com
> > SQL Server Consulting sql at greenms.com
> >
> >
>|||This is a multi-part message in MIME format.
--040005020201060803030401
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Greg D. Moore (Strider) wrote:
>"Michael Hotek" <mike@.solidqualitylearning.com> wrote in message
>news:%23D%23lFF8YGHA.500@.TK2MSFTNGP03.phx.gbl...
>
>>Go to the Product Feedback Center and file it as a bug.
>>
>What's the specific URL?
>
http://lab.msdn.microsoft.com/productfeedback/default.aspx
--
*mike hodgson*
http://sqlnerd.blogspot.com
--040005020201060803030401
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
<br>
Greg D. Moore (Strider) wrote:
<blockquote cite="mideCI2gnPZGHA.4752@.TK2MSFTNGP02.phx.gbl" type="cite">
<pre wrap="">"Michael Hotek" <a class="moz-txt-link-rfc2396E" href="http://links.10026.com/?link=mailto:mike@.solidqualitylearning.com"><mike@.solidqualitylearning.com></a> wrote in message
<a class="moz-txt-link-freetext" href="http://links.10026.com/?link=news:%23D%23lFF8YGHA.500@.TK2MSFTNGP03.phx.gbl">news:%23D%23lFF8YGHA.500@.TK2MSFTNGP03.phx.gbl</a>...
</pre>
<blockquote type="cite">
<pre wrap="">Go to the Product Feedback Center and file it as a bug.
</pre>
</blockquote>
<pre wrap=""><!-->
What's the specific URL?
</pre>
</blockquote>
<tt><a class="moz-txt-link-freetext" href="http://links.10026.com/?link=http://lab.msdn.microsoft.com/productfeedback/default.aspx</a></tt><br>">http://lab.msdn.microsoft.com/productfeedback/default.aspx">http://lab.msdn.microsoft.com/productfeedback/default.aspx</a></tt><br>
<br>
<div class="moz-signature">
<title></title>
<meta http-equiv="Content-Type" content="text/html; ">
<p><span lang="en-au"><font face="Tahoma" size="2">--<br>
</font></span> <b><span lang="en-au"><font face="Tahoma" size="2">mike
hodgson</font></span></b><span lang="en-au"><br>
<font face="Tahoma" size="2"><a href="http://links.10026.com/?link=http://sqlnerd.blogspot.com</a></font></span>">http://sqlnerd.blogspot.com">http://sqlnerd.blogspot.com</a></font></span>
</p>
</div>
<br>
</body>
</html>
--040005020201060803030401--
Was given an alter table script to add two columns to a table we have. As
we use replication and I needed these two columns to replicate, I couldn't
simply use the alter table script but had to translate it into using
sp_repladdcolumn.
No, in the original script, it was: (and forgive typos, going on memory
here)
alter table table_foo
add column [target_object_cache_time] int not null default(0);
Now, if I create the column that way, it adds the column
target_object_cache_time.
However, when I used sp_repladdcolumn 'table_foo',
'[target_object_cache_time]', 'int not null deafult(0)';
it creates the columns with the [] around the name. i.e.
[target_object_cache_time] Moreover, it appeared to create it as
[target_object_cache_time]] on the subscribers.
Needless to say, when I tried to update the stored proc, which uses the new
column, it failed since it was looking for target_object_cache_time not
[target_object_cache_time].
Ok, not a big deal, I figure I'd issue a sp_repldropcolumn and recreate the
columns.
Here's the error message I recieved:
Category:COMMAND
Source: Failed Command
Number:
Message: if exists (select * from syscolumns where
name='[target_object_cache_time]'
and id = object_id('table_foo'))
begin if exists (select * from sysobjects where name='syspublications')
if exists (select * from sysarticles where objid=object_id('table_foo'))
and @.@.microsoftversion >= 0x07320000
exec sp_repldropcolumn
@.source_object=N'[table_foo]',@.column=N'[target_object_cache_time]'
else alter table [table_foo] drop column [[target_object_cache_time]]] else
alter table [table_foo] drop column [[t
(it got cut off).
As you can see, sometimes it's treating it with an extra set of [] and
sometimes not.
It seems to me that sp_repladdcolumn should treat [] the same way as alter
table does. But even if it doesn't, it seems to me that you should be able
to drop the columns cleanly at least.
Thoughts? (I didn't really test too much reproduction since I was trying to
get the root problem fixed on our prod boxes at the time. :-)
If I get a chance, I may try to reproduce this again later if no one else
can.
--
--
Greg D. Moore
President Green Mountain Software
Personal: http://stratton.greenms.com
SQL Server Consulting sql at greenms.comGo to the Product Feedback Center and file it as a bug. It is using
brackets to ensure that there aren't any issues with spaces in the names.
--
Mike
http://www.solidqualitylearning.com
Disclaimer: This communication is an original work and represents my sole
views on the subject. It does not represent the views of any other person
or entity either by inference or direct reference.
"Greg D. Moore (Strider)" <mooregr_deleteth1s@.greenms.com> wrote in message
news:eHQ78PxYGHA.5012@.TK2MSFTNGP04.phx.gbl...
> Had something interesting happen yesterday.
> Was given an alter table script to add two columns to a table we have. As
> we use replication and I needed these two columns to replicate, I couldn't
> simply use the alter table script but had to translate it into using
> sp_repladdcolumn.
> No, in the original script, it was: (and forgive typos, going on memory
> here)
> alter table table_foo
> add column [target_object_cache_time] int not null default(0);
> Now, if I create the column that way, it adds the column
> target_object_cache_time.
> However, when I used sp_repladdcolumn 'table_foo',
> '[target_object_cache_time]', 'int not null deafult(0)';
> it creates the columns with the [] around the name. i.e.
> [target_object_cache_time] Moreover, it appeared to create it as
> [target_object_cache_time]] on the subscribers.
> Needless to say, when I tried to update the stored proc, which uses the
> new
> column, it failed since it was looking for target_object_cache_time not
> [target_object_cache_time].
> Ok, not a big deal, I figure I'd issue a sp_repldropcolumn and recreate
> the
> columns.
> Here's the error message I recieved:
> Category:COMMAND
> Source: Failed Command
> Number:
> Message: if exists (select * from syscolumns where
> name='[target_object_cache_time]'
> and id = object_id('table_foo'))
> begin if exists (select * from sysobjects where name='syspublications')
> if exists (select * from sysarticles where objid=object_id('table_foo'))
> and @.@.microsoftversion >= 0x07320000
> exec sp_repldropcolumn
> @.source_object=N'[table_foo]',@.column=N'[target_object_cache_time]'
> else alter table [table_foo] drop column [[target_object_cache_time]]]
> else
> alter table [table_foo] drop column [[t
> (it got cut off).
> As you can see, sometimes it's treating it with an extra set of [] and
> sometimes not.
> It seems to me that sp_repladdcolumn should treat [] the same way as alter
> table does. But even if it doesn't, it seems to me that you should be
> able
> to drop the columns cleanly at least.
> Thoughts? (I didn't really test too much reproduction since I was trying
> to
> get the root problem fixed on our prod boxes at the time. :-)
> If I get a chance, I may try to reproduce this again later if no one else
> can.
>
>
>
> --
> --
> Greg D. Moore
> President Green Mountain Software
> Personal: http://stratton.greenms.com
> SQL Server Consulting sql at greenms.com
>|||"Michael Hotek" <mike@.solidqualitylearning.com> wrote in message
news:%23D%23lFF8YGHA.500@.TK2MSFTNGP03.phx.gbl...
> Go to the Product Feedback Center and file it as a bug.
What's the specific URL?
> It is using
> brackets to ensure that there aren't any issues with spaces in the names.
Right, but besides using them wrongly, it's inconsistent in its use of them.
:-)
> --
> Mike
> http://www.solidqualitylearning.com
> Disclaimer: This communication is an original work and represents my sole
> views on the subject. It does not represent the views of any other person
> or entity either by inference or direct reference.
>
> "Greg D. Moore (Strider)" <mooregr_deleteth1s@.greenms.com> wrote in
message
> news:eHQ78PxYGHA.5012@.TK2MSFTNGP04.phx.gbl...
> >
> > Had something interesting happen yesterday.
> >
> > Was given an alter table script to add two columns to a table we have.
As
> > we use replication and I needed these two columns to replicate, I
couldn't
> > simply use the alter table script but had to translate it into using
> > sp_repladdcolumn.
> >
> > No, in the original script, it was: (and forgive typos, going on memory
> > here)
> >
> > alter table table_foo
> > add column [target_object_cache_time] int not null default(0);
> >
> > Now, if I create the column that way, it adds the column
> > target_object_cache_time.
> >
> > However, when I used sp_repladdcolumn 'table_foo',
> > '[target_object_cache_time]', 'int not null deafult(0)';
> >
> > it creates the columns with the [] around the name. i.e.
> > [target_object_cache_time] Moreover, it appeared to create it as
> > [target_object_cache_time]] on the subscribers.
> >
> > Needless to say, when I tried to update the stored proc, which uses the
> > new
> > column, it failed since it was looking for target_object_cache_time not
> > [target_object_cache_time].
> >
> > Ok, not a big deal, I figure I'd issue a sp_repldropcolumn and recreate
> > the
> > columns.
> >
> > Here's the error message I recieved:
> >
> > Category:COMMAND
> > Source: Failed Command
> > Number:
> > Message: if exists (select * from syscolumns where
> > name='[target_object_cache_time]'
> > and id = object_id('table_foo'))
> > begin if exists (select * from sysobjects where name='syspublications')
> > if exists (select * from sysarticles where objid=object_id('table_foo'))
> > and @.@.microsoftversion >= 0x07320000
> >
> > exec sp_repldropcolumn
> > @.source_object=N'[table_foo]',@.column=N'[target_object_cache_time]'
> > else alter table [table_foo] drop column [[target_object_cache_time]]]
> > else
> > alter table [table_foo] drop column [[t
> >
> > (it got cut off).
> >
> > As you can see, sometimes it's treating it with an extra set of [] and
> > sometimes not.
> >
> > It seems to me that sp_repladdcolumn should treat [] the same way as
alter
> > table does. But even if it doesn't, it seems to me that you should be
> > able
> > to drop the columns cleanly at least.
> >
> > Thoughts? (I didn't really test too much reproduction since I was
trying
> > to
> > get the root problem fixed on our prod boxes at the time. :-)
> >
> > If I get a chance, I may try to reproduce this again later if no one
else
> > can.
> >
> >
> >
> >
> >
> >
> > --
> > --
> > Greg D. Moore
> > President Green Mountain Software
> > Personal: http://stratton.greenms.com
> > SQL Server Consulting sql at greenms.com
> >
> >
>|||This is a multi-part message in MIME format.
--040005020201060803030401
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Greg D. Moore (Strider) wrote:
>"Michael Hotek" <mike@.solidqualitylearning.com> wrote in message
>news:%23D%23lFF8YGHA.500@.TK2MSFTNGP03.phx.gbl...
>
>>Go to the Product Feedback Center and file it as a bug.
>>
>What's the specific URL?
>
http://lab.msdn.microsoft.com/productfeedback/default.aspx
--
*mike hodgson*
http://sqlnerd.blogspot.com
--040005020201060803030401
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
<br>
Greg D. Moore (Strider) wrote:
<blockquote cite="mideCI2gnPZGHA.4752@.TK2MSFTNGP02.phx.gbl" type="cite">
<pre wrap="">"Michael Hotek" <a class="moz-txt-link-rfc2396E" href="http://links.10026.com/?link=mailto:mike@.solidqualitylearning.com"><mike@.solidqualitylearning.com></a> wrote in message
<a class="moz-txt-link-freetext" href="http://links.10026.com/?link=news:%23D%23lFF8YGHA.500@.TK2MSFTNGP03.phx.gbl">news:%23D%23lFF8YGHA.500@.TK2MSFTNGP03.phx.gbl</a>...
</pre>
<blockquote type="cite">
<pre wrap="">Go to the Product Feedback Center and file it as a bug.
</pre>
</blockquote>
<pre wrap=""><!-->
What's the specific URL?
</pre>
</blockquote>
<tt><a class="moz-txt-link-freetext" href="http://links.10026.com/?link=http://lab.msdn.microsoft.com/productfeedback/default.aspx</a></tt><br>">http://lab.msdn.microsoft.com/productfeedback/default.aspx">http://lab.msdn.microsoft.com/productfeedback/default.aspx</a></tt><br>
<br>
<div class="moz-signature">
<title></title>
<meta http-equiv="Content-Type" content="text/html; ">
<p><span lang="en-au"><font face="Tahoma" size="2">--<br>
</font></span> <b><span lang="en-au"><font face="Tahoma" size="2">mike
hodgson</font></span></b><span lang="en-au"><br>
<font face="Tahoma" size="2"><a href="http://links.10026.com/?link=http://sqlnerd.blogspot.com</a></font></span>">http://sqlnerd.blogspot.com">http://sqlnerd.blogspot.com</a></font></span>
</p>
</div>
<br>
</body>
</html>
--040005020201060803030401--
Labels:
alter,
bug,
columns,
database,
interesting,
microsoft,
mysql,
oracle,
replication,
script,
server,
sp_repladdcolumn,
sp4,
sql,
table
Monday, February 20, 2012
Possible bug
Hi People,
Does any body have any information how to report a possible SQL Server bug. I think I found the very interesting one
Thanks,
Dusko Vuksanovic
woox@.gmx.net
This is a good place to start. If it is a new one, I am sure myself or
another MVP will let Microsoft know.
Geoff N. Hiten
Senior Database Administrator
Microsoft SQL Server MVP
"Dusko Vuksanovic" <woox@.gmx.com> wrote in message
news:eYS8MCZrFHA.3216@.TK2MSFTNGP12.phx.gbl...
> Hi People,
> Does any body have any information how to report a possible SQL Server
> bug. I think I found the very interesting one
>
> Thanks,
> Dusko Vuksanovic
> woox@.gmx.net
>
|||Ok. Thanks Geoff.
Here is the brief description; I created a simple scalar UDF, and pointed it to a field in table as "Default Value". Amaizingly,
filled value in the table was always zero (0), instead of the integer value returned from UDF.
UDF is returning INT value, and field for filling the "Default Value" is INT too.
By the way, I think I'm having SQL2000 , SP3
Here is the sample TSQL (IntVal shoul always be 111 instead of 0; I cripled example to be as simple as possible):
--UDF:
CREATE FUNCTION dbo.Function1
()
RETURNS INT
AS
BEGIN
RETURN 111
END
--TABLE
/****** Object: Table [dbo].[TktTrack] Script Date: 8/30/2005 11:41:54 AM ******/
CREATE TABLE [dbo].[TktTrack] (
[IntVal] [int] NOT NULL ,
[ANum] [int] NOT NULL
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[TktTrack] WITH NOCHECK ADD
CONSTRAINT [DF_TktTrack_IntVal] DEFAULT ([dbo].[Function1]()) FOR [IntVal]
GO
"Geoff N. Hiten" <sqlcraftsman@.gmail.com> wrote in message news:OLVcuDZrFHA.3596@.TK2MSFTNGP15.phx.gbl...
> This is a good place to start. If it is a new one, I am sure myself or
> another MVP will let Microsoft know.
> --
> Geoff N. Hiten
> Senior Database Administrator
> Microsoft SQL Server MVP
> "Dusko Vuksanovic" <woox@.gmx.com> wrote in message
> news:eYS8MCZrFHA.3216@.TK2MSFTNGP12.phx.gbl...
>
|||On Tue, 30 Aug 2005 11:45:53 -0700, Dusko Vuksanovic wrote:
>Ok. Thanks Geoff.
>Here is the brief description; I created a simple scalar UDF, and pointed it to a field in table as "Default Value". Amaizingly,
>filled value in the table was always zero (0), instead of the integer value returned from UDF.
>UDF is returning INT value, and field for filling the "Default Value" is INT too.
>By the way, I think I'm having SQL2000 , SP3
Hi Dusko,
I couldn't reproduce it on SP4:
CREATE FUNCTION dbo.Function1
()
RETURNS INT
AS
BEGIN
RETURN 111
END
go
--TABLE
/****** Object: Table [dbo].[TktTrack] Script Date: 8/30/2005
11:41:54 AM ******/
CREATE TABLE [dbo].[TktTrack] (
[IntVal] [int] NOT NULL ,
[ANum] [int] NOT NULL
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[TktTrack] WITH NOCHECK ADD
CONSTRAINT [DF_TktTrack_IntVal] DEFAULT ([dbo].[Function1]()) FOR
[IntVal]
GO
insert TktTrack (IntVal, ANum) values(default, 1)
go
select * from TktTrack
go
drop table TktTrack
go
drop function dbo.Function1
go
select @.@.version
go
IntVal ANum
-- --
111 1
Microsoft SQL Server 2000 - 8.00.2039 (Intel X86)
May 3 2005 23:18:38
Copyright (c) 1988-2003 Microsoft Corporation
Personal Edition on Windows NT 5.0 (Build 2195: Service Pack 4)
Best, Hugo
(Remove _NO_ and _SPAM_ to get my e-mail address)
|||You are right, Geoff. It works. However, if I manually insert the record in SQL Manager, I must refresh it to see the value (this is
kind of "buggy" behaviour, because it will show 0 at the first place).
Thanks,
Dusko
"Hugo Kornelis" <hugo@.pe_NO_rFact.in_SPAM_fo> wrote in message news:jbc9h1pc4jdc13j7hr9g1t15mmjt7cc7fk@.4ax.com...
> On Tue, 30 Aug 2005 11:45:53 -0700, Dusko Vuksanovic wrote:
>
> Hi Dusko,
> I couldn't reproduce it on SP4:
> CREATE FUNCTION dbo.Function1
> ()
> RETURNS INT
> AS
> BEGIN
> RETURN 111
> END
> go
> --TABLE
> /****** Object: Table [dbo].[TktTrack] Script Date: 8/30/2005
> 11:41:54 AM ******/
> CREATE TABLE [dbo].[TktTrack] (
> [IntVal] [int] NOT NULL ,
> [ANum] [int] NOT NULL
> ) ON [PRIMARY]
> GO
> ALTER TABLE [dbo].[TktTrack] WITH NOCHECK ADD
> CONSTRAINT [DF_TktTrack_IntVal] DEFAULT ([dbo].[Function1]()) FOR
> [IntVal]
> GO
> insert TktTrack (IntVal, ANum) values(default, 1)
> go
> select * from TktTrack
> go
> drop table TktTrack
> go
> drop function dbo.Function1
> go
> select @.@.version
> go
> IntVal ANum
> -- --
> 111 1
>
> Microsoft SQL Server 2000 - 8.00.2039 (Intel X86)
> May 3 2005 23:18:38
> Copyright (c) 1988-2003 Microsoft Corporation
> Personal Edition on Windows NT 5.0 (Build 2195: Service Pack 4)
>
>
> Best, Hugo
> --
> (Remove _NO_ and _SPAM_ to get my e-mail address)
|||Wasn't me. Thank Hugo.
Geoff N. Hiten
Senior Database Administrator
Microsoft SQL Server MVP
"Dusko Vuksanovic" <woox@.gmx.com> wrote in message
news:%23ASqlqarFHA.3604@.tk2msftngp13.phx.gbl...
> You are right, Geoff. It works. However, if I manually insert the record
> in SQL Manager, I must refresh it to see the value (this is
> kind of "buggy" behaviour, because it will show 0 at the first place).
> Thanks,
> Dusko
> "Hugo Kornelis" <hugo@.pe_NO_rFact.in_SPAM_fo> wrote in message
> news:jbc9h1pc4jdc13j7hr9g1t15mmjt7cc7fk@.4ax.com...
>
|||On Tue, 30 Aug 2005 14:34:45 -0700, Dusko Vuksanovic wrote:
>You are right, Geoff. It works. However, if I manually insert the record in SQL Manager, I must refresh it to see the value (this is
>kind of "buggy" behaviour, because it will show 0 at the first place).
Hi Dusko,
Enterprise Manager *IS* buggy when you use it to change data. Don't.
In this case, the most likely explanation is that this is a result of
not having a primary key on the table.
<speculation>
When you insert data in a table through EM, EM will check if any data
gets changed automaGically, so it reads back the row you just inserted.
If the table has a kkey (as all good tables should), EM uses just the
key values to find the row just inserted. But if there's no key, EM has
no choice but to match on all columns.
Of course, since one of the columns gets populated with a value
different from what you entered in EM (that's what the default is for,
of course), EM can't find the row. Only after refreshing the table will
the row show up, as EM will read the complete table when you refresh.
</speculation>
Best, Hugo
(Remove _NO_ and _SPAM_ to get my e-mail address)
Does any body have any information how to report a possible SQL Server bug. I think I found the very interesting one
Thanks,
Dusko Vuksanovic
woox@.gmx.net
This is a good place to start. If it is a new one, I am sure myself or
another MVP will let Microsoft know.
Geoff N. Hiten
Senior Database Administrator
Microsoft SQL Server MVP
"Dusko Vuksanovic" <woox@.gmx.com> wrote in message
news:eYS8MCZrFHA.3216@.TK2MSFTNGP12.phx.gbl...
> Hi People,
> Does any body have any information how to report a possible SQL Server
> bug. I think I found the very interesting one
>
> Thanks,
> Dusko Vuksanovic
> woox@.gmx.net
>
|||Ok. Thanks Geoff.
Here is the brief description; I created a simple scalar UDF, and pointed it to a field in table as "Default Value". Amaizingly,
filled value in the table was always zero (0), instead of the integer value returned from UDF.
UDF is returning INT value, and field for filling the "Default Value" is INT too.
By the way, I think I'm having SQL2000 , SP3
Here is the sample TSQL (IntVal shoul always be 111 instead of 0; I cripled example to be as simple as possible):
--UDF:
CREATE FUNCTION dbo.Function1
()
RETURNS INT
AS
BEGIN
RETURN 111
END
--TABLE
/****** Object: Table [dbo].[TktTrack] Script Date: 8/30/2005 11:41:54 AM ******/
CREATE TABLE [dbo].[TktTrack] (
[IntVal] [int] NOT NULL ,
[ANum] [int] NOT NULL
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[TktTrack] WITH NOCHECK ADD
CONSTRAINT [DF_TktTrack_IntVal] DEFAULT ([dbo].[Function1]()) FOR [IntVal]
GO
"Geoff N. Hiten" <sqlcraftsman@.gmail.com> wrote in message news:OLVcuDZrFHA.3596@.TK2MSFTNGP15.phx.gbl...
> This is a good place to start. If it is a new one, I am sure myself or
> another MVP will let Microsoft know.
> --
> Geoff N. Hiten
> Senior Database Administrator
> Microsoft SQL Server MVP
> "Dusko Vuksanovic" <woox@.gmx.com> wrote in message
> news:eYS8MCZrFHA.3216@.TK2MSFTNGP12.phx.gbl...
>
|||On Tue, 30 Aug 2005 11:45:53 -0700, Dusko Vuksanovic wrote:
>Ok. Thanks Geoff.
>Here is the brief description; I created a simple scalar UDF, and pointed it to a field in table as "Default Value". Amaizingly,
>filled value in the table was always zero (0), instead of the integer value returned from UDF.
>UDF is returning INT value, and field for filling the "Default Value" is INT too.
>By the way, I think I'm having SQL2000 , SP3
Hi Dusko,
I couldn't reproduce it on SP4:
CREATE FUNCTION dbo.Function1
()
RETURNS INT
AS
BEGIN
RETURN 111
END
go
--TABLE
/****** Object: Table [dbo].[TktTrack] Script Date: 8/30/2005
11:41:54 AM ******/
CREATE TABLE [dbo].[TktTrack] (
[IntVal] [int] NOT NULL ,
[ANum] [int] NOT NULL
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[TktTrack] WITH NOCHECK ADD
CONSTRAINT [DF_TktTrack_IntVal] DEFAULT ([dbo].[Function1]()) FOR
[IntVal]
GO
insert TktTrack (IntVal, ANum) values(default, 1)
go
select * from TktTrack
go
drop table TktTrack
go
drop function dbo.Function1
go
select @.@.version
go
IntVal ANum
-- --
111 1
Microsoft SQL Server 2000 - 8.00.2039 (Intel X86)
May 3 2005 23:18:38
Copyright (c) 1988-2003 Microsoft Corporation
Personal Edition on Windows NT 5.0 (Build 2195: Service Pack 4)
Best, Hugo
(Remove _NO_ and _SPAM_ to get my e-mail address)
|||You are right, Geoff. It works. However, if I manually insert the record in SQL Manager, I must refresh it to see the value (this is
kind of "buggy" behaviour, because it will show 0 at the first place).
Thanks,
Dusko
"Hugo Kornelis" <hugo@.pe_NO_rFact.in_SPAM_fo> wrote in message news:jbc9h1pc4jdc13j7hr9g1t15mmjt7cc7fk@.4ax.com...
> On Tue, 30 Aug 2005 11:45:53 -0700, Dusko Vuksanovic wrote:
>
> Hi Dusko,
> I couldn't reproduce it on SP4:
> CREATE FUNCTION dbo.Function1
> ()
> RETURNS INT
> AS
> BEGIN
> RETURN 111
> END
> go
> --TABLE
> /****** Object: Table [dbo].[TktTrack] Script Date: 8/30/2005
> 11:41:54 AM ******/
> CREATE TABLE [dbo].[TktTrack] (
> [IntVal] [int] NOT NULL ,
> [ANum] [int] NOT NULL
> ) ON [PRIMARY]
> GO
> ALTER TABLE [dbo].[TktTrack] WITH NOCHECK ADD
> CONSTRAINT [DF_TktTrack_IntVal] DEFAULT ([dbo].[Function1]()) FOR
> [IntVal]
> GO
> insert TktTrack (IntVal, ANum) values(default, 1)
> go
> select * from TktTrack
> go
> drop table TktTrack
> go
> drop function dbo.Function1
> go
> select @.@.version
> go
> IntVal ANum
> -- --
> 111 1
>
> Microsoft SQL Server 2000 - 8.00.2039 (Intel X86)
> May 3 2005 23:18:38
> Copyright (c) 1988-2003 Microsoft Corporation
> Personal Edition on Windows NT 5.0 (Build 2195: Service Pack 4)
>
>
> Best, Hugo
> --
> (Remove _NO_ and _SPAM_ to get my e-mail address)
|||Wasn't me. Thank Hugo.
Geoff N. Hiten
Senior Database Administrator
Microsoft SQL Server MVP
"Dusko Vuksanovic" <woox@.gmx.com> wrote in message
news:%23ASqlqarFHA.3604@.tk2msftngp13.phx.gbl...
> You are right, Geoff. It works. However, if I manually insert the record
> in SQL Manager, I must refresh it to see the value (this is
> kind of "buggy" behaviour, because it will show 0 at the first place).
> Thanks,
> Dusko
> "Hugo Kornelis" <hugo@.pe_NO_rFact.in_SPAM_fo> wrote in message
> news:jbc9h1pc4jdc13j7hr9g1t15mmjt7cc7fk@.4ax.com...
>
|||On Tue, 30 Aug 2005 14:34:45 -0700, Dusko Vuksanovic wrote:
>You are right, Geoff. It works. However, if I manually insert the record in SQL Manager, I must refresh it to see the value (this is
>kind of "buggy" behaviour, because it will show 0 at the first place).
Hi Dusko,
Enterprise Manager *IS* buggy when you use it to change data. Don't.
In this case, the most likely explanation is that this is a result of
not having a primary key on the table.
<speculation>
When you insert data in a table through EM, EM will check if any data
gets changed automaGically, so it reads back the row you just inserted.
If the table has a kkey (as all good tables should), EM uses just the
key values to find the row just inserted. But if there's no key, EM has
no choice but to match on all columns.
Of course, since one of the columns gets populated with a value
different from what you entered in EM (that's what the default is for,
of course), EM can't find the row. Only after refreshing the table will
the row show up, as EM will read the complete table when you refresh.
</speculation>
Best, Hugo
(Remove _NO_ and _SPAM_ to get my e-mail address)
Possible bug
Hi People,
Does any body have any information how to report a possible SQL Server bug. I think I found the very interesting one :)
Thanks,
Dusko Vuksanovic
woox@.gmx.netThis is a good place to start. If it is a new one, I am sure myself or
another MVP will let Microsoft know.
--
Geoff N. Hiten
Senior Database Administrator
Microsoft SQL Server MVP
"Dusko Vuksanovic" <woox@.gmx.com> wrote in message
news:eYS8MCZrFHA.3216@.TK2MSFTNGP12.phx.gbl...
> Hi People,
> Does any body have any information how to report a possible SQL Server
> bug. I think I found the very interesting one :)
>
> Thanks,
> Dusko Vuksanovic
> woox@.gmx.net
>|||Ok. Thanks Geoff.
Here is the brief description; I created a simple scalar UDF, and pointed it to a field in table as "Default Value". Amaizingly,
filled value in the table was always zero (0), instead of the integer value returned from UDF.
UDF is returning INT value, and field for filling the "Default Value" is INT too.
By the way, I think I'm having SQL2000 , SP3
Here is the sample TSQL (IntVal shoul always be 111 instead of 0; I cripled example to be as simple as possible):
--UDF:
CREATE FUNCTION dbo.Function1
()
RETURNS INT
AS
BEGIN
RETURN 111
END
--TABLE
/****** Object: Table [dbo].[TktTrack] Script Date: 8/30/2005 11:41:54 AM ******/
CREATE TABLE [dbo].[TktTrack] (
[IntVal] [int] NOT NULL ,
[ANum] [int] NOT NULL
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[TktTrack] WITH NOCHECK ADD
CONSTRAINT [DF_TktTrack_IntVal] DEFAULT ([dbo].[Function1]()) FOR [IntVal]
GO
"Geoff N. Hiten" <sqlcraftsman@.gmail.com> wrote in message news:OLVcuDZrFHA.3596@.TK2MSFTNGP15.phx.gbl...
> This is a good place to start. If it is a new one, I am sure myself or
> another MVP will let Microsoft know.
> --
> Geoff N. Hiten
> Senior Database Administrator
> Microsoft SQL Server MVP
> "Dusko Vuksanovic" <woox@.gmx.com> wrote in message
> news:eYS8MCZrFHA.3216@.TK2MSFTNGP12.phx.gbl...
> > Hi People,
> >
> > Does any body have any information how to report a possible SQL Server
> > bug. I think I found the very interesting one :)
> >
> >
> > Thanks,
> >
> > Dusko Vuksanovic
> > woox@.gmx.net
> >
> >
>|||On Tue, 30 Aug 2005 11:45:53 -0700, Dusko Vuksanovic wrote:
>Ok. Thanks Geoff.
>Here is the brief description; I created a simple scalar UDF, and pointed it to a field in table as "Default Value". Amaizingly,
>filled value in the table was always zero (0), instead of the integer value returned from UDF.
>UDF is returning INT value, and field for filling the "Default Value" is INT too.
>By the way, I think I'm having SQL2000 , SP3
Hi Dusko,
I couldn't reproduce it on SP4:
CREATE FUNCTION dbo.Function1
()
RETURNS INT
AS
BEGIN
RETURN 111
END
go
--TABLE
/****** Object: Table [dbo].[TktTrack] Script Date: 8/30/2005
11:41:54 AM ******/
CREATE TABLE [dbo].[TktTrack] (
[IntVal] [int] NOT NULL ,
[ANum] [int] NOT NULL
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[TktTrack] WITH NOCHECK ADD
CONSTRAINT [DF_TktTrack_IntVal] DEFAULT ([dbo].[Function1]()) FOR
[IntVal]
GO
insert TktTrack (IntVal, ANum) values(default, 1)
go
select * from TktTrack
go
drop table TktTrack
go
drop function dbo.Function1
go
select @.@.version
go
IntVal ANum
-- --
111 1
---
Microsoft SQL Server 2000 - 8.00.2039 (Intel X86)
May 3 2005 23:18:38
Copyright (c) 1988-2003 Microsoft Corporation
Personal Edition on Windows NT 5.0 (Build 2195: Service Pack 4)
Best, Hugo
--
(Remove _NO_ and _SPAM_ to get my e-mail address)|||You are right, Geoff. It works. However, if I manually insert the record in SQL Manager, I must refresh it to see the value (this is
kind of "buggy" behaviour, because it will show 0 at the first place).
Thanks,
Dusko
"Hugo Kornelis" <hugo@.pe_NO_rFact.in_SPAM_fo> wrote in message news:jbc9h1pc4jdc13j7hr9g1t15mmjt7cc7fk@.4ax.com...
> On Tue, 30 Aug 2005 11:45:53 -0700, Dusko Vuksanovic wrote:
> >Ok. Thanks Geoff.
> >
> >Here is the brief description; I created a simple scalar UDF, and pointed it to a field in table as "Default Value". Amaizingly,
> >filled value in the table was always zero (0), instead of the integer value returned from UDF.
> >
> >UDF is returning INT value, and field for filling the "Default Value" is INT too.
> >
> >By the way, I think I'm having SQL2000 , SP3
> Hi Dusko,
> I couldn't reproduce it on SP4:
> CREATE FUNCTION dbo.Function1
> ()
> RETURNS INT
> AS
> BEGIN
> RETURN 111
> END
> go
> --TABLE
> /****** Object: Table [dbo].[TktTrack] Script Date: 8/30/2005
> 11:41:54 AM ******/
> CREATE TABLE [dbo].[TktTrack] (
> [IntVal] [int] NOT NULL ,
> [ANum] [int] NOT NULL
> ) ON [PRIMARY]
> GO
> ALTER TABLE [dbo].[TktTrack] WITH NOCHECK ADD
> CONSTRAINT [DF_TktTrack_IntVal] DEFAULT ([dbo].[Function1]()) FOR
> [IntVal]
> GO
> insert TktTrack (IntVal, ANum) values(default, 1)
> go
> select * from TktTrack
> go
> drop table TktTrack
> go
> drop function dbo.Function1
> go
> select @.@.version
> go
> IntVal ANum
> -- --
> 111 1
>
> ---
> Microsoft SQL Server 2000 - 8.00.2039 (Intel X86)
> May 3 2005 23:18:38
> Copyright (c) 1988-2003 Microsoft Corporation
> Personal Edition on Windows NT 5.0 (Build 2195: Service Pack 4)
>
>
> Best, Hugo
> --
> (Remove _NO_ and _SPAM_ to get my e-mail address)|||Wasn't me. Thank Hugo.
--
Geoff N. Hiten
Senior Database Administrator
Microsoft SQL Server MVP
"Dusko Vuksanovic" <woox@.gmx.com> wrote in message
news:%23ASqlqarFHA.3604@.tk2msftngp13.phx.gbl...
> You are right, Geoff. It works. However, if I manually insert the record
> in SQL Manager, I must refresh it to see the value (this is
> kind of "buggy" behaviour, because it will show 0 at the first place).
> Thanks,
> Dusko
> "Hugo Kornelis" <hugo@.pe_NO_rFact.in_SPAM_fo> wrote in message
> news:jbc9h1pc4jdc13j7hr9g1t15mmjt7cc7fk@.4ax.com...
>> On Tue, 30 Aug 2005 11:45:53 -0700, Dusko Vuksanovic wrote:
>> >Ok. Thanks Geoff.
>> >
>> >Here is the brief description; I created a simple scalar UDF, and
>> >pointed it to a field in table as "Default Value". Amaizingly,
>> >filled value in the table was always zero (0), instead of the integer
>> >value returned from UDF.
>> >
>> >UDF is returning INT value, and field for filling the "Default Value" is
>> >INT too.
>> >
>> >By the way, I think I'm having SQL2000 , SP3
>> Hi Dusko,
>> I couldn't reproduce it on SP4:
>> CREATE FUNCTION dbo.Function1
>> ()
>> RETURNS INT
>> AS
>> BEGIN
>> RETURN 111
>> END
>> go
>> --TABLE
>> /****** Object: Table [dbo].[TktTrack] Script Date: 8/30/2005
>> 11:41:54 AM ******/
>> CREATE TABLE [dbo].[TktTrack] (
>> [IntVal] [int] NOT NULL ,
>> [ANum] [int] NOT NULL
>> ) ON [PRIMARY]
>> GO
>> ALTER TABLE [dbo].[TktTrack] WITH NOCHECK ADD
>> CONSTRAINT [DF_TktTrack_IntVal] DEFAULT ([dbo].[Function1]()) FOR
>> [IntVal]
>> GO
>> insert TktTrack (IntVal, ANum) values(default, 1)
>> go
>> select * from TktTrack
>> go
>> drop table TktTrack
>> go
>> drop function dbo.Function1
>> go
>> select @.@.version
>> go
>> IntVal ANum
>> -- --
>> 111 1
>>
>> ---
>> Microsoft SQL Server 2000 - 8.00.2039 (Intel X86)
>> May 3 2005 23:18:38
>> Copyright (c) 1988-2003 Microsoft Corporation
>> Personal Edition on Windows NT 5.0 (Build 2195: Service Pack 4)
>>
>>
>> Best, Hugo
>> --
>> (Remove _NO_ and _SPAM_ to get my e-mail address)
>|||On Tue, 30 Aug 2005 14:34:45 -0700, Dusko Vuksanovic wrote:
>You are right, Geoff. It works. However, if I manually insert the record in SQL Manager, I must refresh it to see the value (this is
>kind of "buggy" behaviour, because it will show 0 at the first place).
Hi Dusko,
Enterprise Manager *IS* buggy when you use it to change data. Don't.
In this case, the most likely explanation is that this is a result of
not having a primary key on the table.
<speculation>
When you insert data in a table through EM, EM will check if any data
gets changed automaGically, so it reads back the row you just inserted.
If the table has a kkey (as all good tables should), EM uses just the
key values to find the row just inserted. But if there's no key, EM has
no choice but to match on all columns.
Of course, since one of the columns gets populated with a value
different from what you entered in EM (that's what the default is for,
of course), EM can't find the row. Only after refreshing the table will
the row show up, as EM will read the complete table when you refresh.
</speculation>
Best, Hugo
--
(Remove _NO_ and _SPAM_ to get my e-mail address)
Does any body have any information how to report a possible SQL Server bug. I think I found the very interesting one :)
Thanks,
Dusko Vuksanovic
woox@.gmx.netThis is a good place to start. If it is a new one, I am sure myself or
another MVP will let Microsoft know.
--
Geoff N. Hiten
Senior Database Administrator
Microsoft SQL Server MVP
"Dusko Vuksanovic" <woox@.gmx.com> wrote in message
news:eYS8MCZrFHA.3216@.TK2MSFTNGP12.phx.gbl...
> Hi People,
> Does any body have any information how to report a possible SQL Server
> bug. I think I found the very interesting one :)
>
> Thanks,
> Dusko Vuksanovic
> woox@.gmx.net
>|||Ok. Thanks Geoff.
Here is the brief description; I created a simple scalar UDF, and pointed it to a field in table as "Default Value". Amaizingly,
filled value in the table was always zero (0), instead of the integer value returned from UDF.
UDF is returning INT value, and field for filling the "Default Value" is INT too.
By the way, I think I'm having SQL2000 , SP3
Here is the sample TSQL (IntVal shoul always be 111 instead of 0; I cripled example to be as simple as possible):
--UDF:
CREATE FUNCTION dbo.Function1
()
RETURNS INT
AS
BEGIN
RETURN 111
END
--TABLE
/****** Object: Table [dbo].[TktTrack] Script Date: 8/30/2005 11:41:54 AM ******/
CREATE TABLE [dbo].[TktTrack] (
[IntVal] [int] NOT NULL ,
[ANum] [int] NOT NULL
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[TktTrack] WITH NOCHECK ADD
CONSTRAINT [DF_TktTrack_IntVal] DEFAULT ([dbo].[Function1]()) FOR [IntVal]
GO
"Geoff N. Hiten" <sqlcraftsman@.gmail.com> wrote in message news:OLVcuDZrFHA.3596@.TK2MSFTNGP15.phx.gbl...
> This is a good place to start. If it is a new one, I am sure myself or
> another MVP will let Microsoft know.
> --
> Geoff N. Hiten
> Senior Database Administrator
> Microsoft SQL Server MVP
> "Dusko Vuksanovic" <woox@.gmx.com> wrote in message
> news:eYS8MCZrFHA.3216@.TK2MSFTNGP12.phx.gbl...
> > Hi People,
> >
> > Does any body have any information how to report a possible SQL Server
> > bug. I think I found the very interesting one :)
> >
> >
> > Thanks,
> >
> > Dusko Vuksanovic
> > woox@.gmx.net
> >
> >
>|||On Tue, 30 Aug 2005 11:45:53 -0700, Dusko Vuksanovic wrote:
>Ok. Thanks Geoff.
>Here is the brief description; I created a simple scalar UDF, and pointed it to a field in table as "Default Value". Amaizingly,
>filled value in the table was always zero (0), instead of the integer value returned from UDF.
>UDF is returning INT value, and field for filling the "Default Value" is INT too.
>By the way, I think I'm having SQL2000 , SP3
Hi Dusko,
I couldn't reproduce it on SP4:
CREATE FUNCTION dbo.Function1
()
RETURNS INT
AS
BEGIN
RETURN 111
END
go
--TABLE
/****** Object: Table [dbo].[TktTrack] Script Date: 8/30/2005
11:41:54 AM ******/
CREATE TABLE [dbo].[TktTrack] (
[IntVal] [int] NOT NULL ,
[ANum] [int] NOT NULL
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[TktTrack] WITH NOCHECK ADD
CONSTRAINT [DF_TktTrack_IntVal] DEFAULT ([dbo].[Function1]()) FOR
[IntVal]
GO
insert TktTrack (IntVal, ANum) values(default, 1)
go
select * from TktTrack
go
drop table TktTrack
go
drop function dbo.Function1
go
select @.@.version
go
IntVal ANum
-- --
111 1
---
Microsoft SQL Server 2000 - 8.00.2039 (Intel X86)
May 3 2005 23:18:38
Copyright (c) 1988-2003 Microsoft Corporation
Personal Edition on Windows NT 5.0 (Build 2195: Service Pack 4)
Best, Hugo
--
(Remove _NO_ and _SPAM_ to get my e-mail address)|||You are right, Geoff. It works. However, if I manually insert the record in SQL Manager, I must refresh it to see the value (this is
kind of "buggy" behaviour, because it will show 0 at the first place).
Thanks,
Dusko
"Hugo Kornelis" <hugo@.pe_NO_rFact.in_SPAM_fo> wrote in message news:jbc9h1pc4jdc13j7hr9g1t15mmjt7cc7fk@.4ax.com...
> On Tue, 30 Aug 2005 11:45:53 -0700, Dusko Vuksanovic wrote:
> >Ok. Thanks Geoff.
> >
> >Here is the brief description; I created a simple scalar UDF, and pointed it to a field in table as "Default Value". Amaizingly,
> >filled value in the table was always zero (0), instead of the integer value returned from UDF.
> >
> >UDF is returning INT value, and field for filling the "Default Value" is INT too.
> >
> >By the way, I think I'm having SQL2000 , SP3
> Hi Dusko,
> I couldn't reproduce it on SP4:
> CREATE FUNCTION dbo.Function1
> ()
> RETURNS INT
> AS
> BEGIN
> RETURN 111
> END
> go
> --TABLE
> /****** Object: Table [dbo].[TktTrack] Script Date: 8/30/2005
> 11:41:54 AM ******/
> CREATE TABLE [dbo].[TktTrack] (
> [IntVal] [int] NOT NULL ,
> [ANum] [int] NOT NULL
> ) ON [PRIMARY]
> GO
> ALTER TABLE [dbo].[TktTrack] WITH NOCHECK ADD
> CONSTRAINT [DF_TktTrack_IntVal] DEFAULT ([dbo].[Function1]()) FOR
> [IntVal]
> GO
> insert TktTrack (IntVal, ANum) values(default, 1)
> go
> select * from TktTrack
> go
> drop table TktTrack
> go
> drop function dbo.Function1
> go
> select @.@.version
> go
> IntVal ANum
> -- --
> 111 1
>
> ---
> Microsoft SQL Server 2000 - 8.00.2039 (Intel X86)
> May 3 2005 23:18:38
> Copyright (c) 1988-2003 Microsoft Corporation
> Personal Edition on Windows NT 5.0 (Build 2195: Service Pack 4)
>
>
> Best, Hugo
> --
> (Remove _NO_ and _SPAM_ to get my e-mail address)|||Wasn't me. Thank Hugo.
--
Geoff N. Hiten
Senior Database Administrator
Microsoft SQL Server MVP
"Dusko Vuksanovic" <woox@.gmx.com> wrote in message
news:%23ASqlqarFHA.3604@.tk2msftngp13.phx.gbl...
> You are right, Geoff. It works. However, if I manually insert the record
> in SQL Manager, I must refresh it to see the value (this is
> kind of "buggy" behaviour, because it will show 0 at the first place).
> Thanks,
> Dusko
> "Hugo Kornelis" <hugo@.pe_NO_rFact.in_SPAM_fo> wrote in message
> news:jbc9h1pc4jdc13j7hr9g1t15mmjt7cc7fk@.4ax.com...
>> On Tue, 30 Aug 2005 11:45:53 -0700, Dusko Vuksanovic wrote:
>> >Ok. Thanks Geoff.
>> >
>> >Here is the brief description; I created a simple scalar UDF, and
>> >pointed it to a field in table as "Default Value". Amaizingly,
>> >filled value in the table was always zero (0), instead of the integer
>> >value returned from UDF.
>> >
>> >UDF is returning INT value, and field for filling the "Default Value" is
>> >INT too.
>> >
>> >By the way, I think I'm having SQL2000 , SP3
>> Hi Dusko,
>> I couldn't reproduce it on SP4:
>> CREATE FUNCTION dbo.Function1
>> ()
>> RETURNS INT
>> AS
>> BEGIN
>> RETURN 111
>> END
>> go
>> --TABLE
>> /****** Object: Table [dbo].[TktTrack] Script Date: 8/30/2005
>> 11:41:54 AM ******/
>> CREATE TABLE [dbo].[TktTrack] (
>> [IntVal] [int] NOT NULL ,
>> [ANum] [int] NOT NULL
>> ) ON [PRIMARY]
>> GO
>> ALTER TABLE [dbo].[TktTrack] WITH NOCHECK ADD
>> CONSTRAINT [DF_TktTrack_IntVal] DEFAULT ([dbo].[Function1]()) FOR
>> [IntVal]
>> GO
>> insert TktTrack (IntVal, ANum) values(default, 1)
>> go
>> select * from TktTrack
>> go
>> drop table TktTrack
>> go
>> drop function dbo.Function1
>> go
>> select @.@.version
>> go
>> IntVal ANum
>> -- --
>> 111 1
>>
>> ---
>> Microsoft SQL Server 2000 - 8.00.2039 (Intel X86)
>> May 3 2005 23:18:38
>> Copyright (c) 1988-2003 Microsoft Corporation
>> Personal Edition on Windows NT 5.0 (Build 2195: Service Pack 4)
>>
>>
>> Best, Hugo
>> --
>> (Remove _NO_ and _SPAM_ to get my e-mail address)
>|||On Tue, 30 Aug 2005 14:34:45 -0700, Dusko Vuksanovic wrote:
>You are right, Geoff. It works. However, if I manually insert the record in SQL Manager, I must refresh it to see the value (this is
>kind of "buggy" behaviour, because it will show 0 at the first place).
Hi Dusko,
Enterprise Manager *IS* buggy when you use it to change data. Don't.
In this case, the most likely explanation is that this is a result of
not having a primary key on the table.
<speculation>
When you insert data in a table through EM, EM will check if any data
gets changed automaGically, so it reads back the row you just inserted.
If the table has a kkey (as all good tables should), EM uses just the
key values to find the row just inserted. But if there's no key, EM has
no choice but to match on all columns.
Of course, since one of the columns gets populated with a value
different from what you entered in EM (that's what the default is for,
of course), EM can't find the row. Only after refreshing the table will
the row show up, as EM will read the complete table when you refresh.
</speculation>
Best, Hugo
--
(Remove _NO_ and _SPAM_ to get my e-mail address)
Possible bug
Hi People,
Does any body have any information how to report a possible SQL Server bug.
I think I found the very interesting one
Thanks,
Dusko Vuksanovic
woox@.gmx.netThis is a good place to start. If it is a new one, I am sure myself or
another MVP will let Microsoft know.
Geoff N. Hiten
Senior Database Administrator
Microsoft SQL Server MVP
"Dusko Vuksanovic" <woox@.gmx.com> wrote in message
news:eYS8MCZrFHA.3216@.TK2MSFTNGP12.phx.gbl...
> Hi People,
> Does any body have any information how to report a possible SQL Server
> bug. I think I found the very interesting one
>
> Thanks,
> Dusko Vuksanovic
> woox@.gmx.net
>|||Ok. Thanks Geoff.
Here is the brief description; I created a simple scalar UDF, and pointed it
to a field in table as "Default Value". Amaizingly,
filled value in the table was always zero (0), instead of the integer value
returned from UDF.
UDF is returning INT value, and field for filling the "Default Value" is INT
too.
By the way, I think I'm having SQL2000 , SP3
Here is the sample TSQL (IntVal shoul always be 111 instead of 0; I cripled
example to be as simple as possible):
--UDF:
CREATE FUNCTION dbo.Function1
()
RETURNS INT
AS
BEGIN
RETURN 111
END
--TABLE
/****** Object: Table [dbo].[TktTrack] Script Date: 8/30/2005 11
:41:54 AM ******/
CREATE TABLE [dbo].[TktTrack] (
[IntVal] [int] NOT NULL ,
[ANum] [int] NOT NULL
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[TktTrack] WITH NOCHECK ADD
CONSTRAINT [DF_TktTrack_IntVal] DEFAULT ([dbo].[Function1]()) FO
R [IntVal]
GO
"Geoff N. Hiten" <sqlcraftsman@.gmail.com> wrote in message news:OLVcuDZrFHA.3596@.TK2MSFTNGP1
5.phx.gbl...
> This is a good place to start. If it is a new one, I am sure myself or
> another MVP will let Microsoft know.
> --
> Geoff N. Hiten
> Senior Database Administrator
> Microsoft SQL Server MVP
> "Dusko Vuksanovic" <woox@.gmx.com> wrote in message
> news:eYS8MCZrFHA.3216@.TK2MSFTNGP12.phx.gbl...
>|||On Tue, 30 Aug 2005 11:45:53 -0700, Dusko Vuksanovic wrote:
>Ok. Thanks Geoff.
>Here is the brief description; I created a simple scalar UDF, and pointed i
t to a field in table as "Default Value". Amaizingly,
>filled value in the table was always zero (0), instead of the integer value
returned from UDF.
>UDF is returning INT value, and field for filling the "Default Value" is IN
T too.
>By the way, I think I'm having SQL2000 , SP3
Hi Dusko,
I couldn't reproduce it on SP4:
CREATE FUNCTION dbo.Function1
()
RETURNS INT
AS
BEGIN
RETURN 111
END
go
--TABLE
/****** Object: Table [dbo].[TktTrack] Script Date: 8/30/2005
11:41:54 AM ******/
CREATE TABLE [dbo].[TktTrack] (
[IntVal] [int] NOT NULL ,
[ANum] [int] NOT NULL
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[TktTrack] WITH NOCHECK ADD
CONSTRAINT [DF_TktTrack_IntVal] DEFAULT ([dbo].[Function1]()) FO
R
[IntVal]
GO
insert TktTrack (IntVal, ANum) values(default, 1)
go
select * from TktTrack
go
drop table TktTrack
go
drop function dbo.Function1
go
select @.@.version
go
IntVal ANum
-- --
111 1
---
Microsoft SQL Server 2000 - 8.00.2039 (Intel X86)
May 3 2005 23:18:38
Copyright (c) 1988-2003 Microsoft Corporation
Personal Edition on Windows NT 5.0 (Build 2195: Service Pack 4)
Best, Hugo
--
(Remove _NO_ and _SPAM_ to get my e-mail address)|||You are right, Geoff. It works. However, if I manually insert the record in
SQL Manager, I must refresh it to see the value (this is
kind of "buggy" behaviour, because it will show 0 at the first place).
Thanks,
Dusko
"Hugo Kornelis" <hugo@.pe_NO_rFact.in_SPAM_fo> wrote in message news:jbc9h1pc4jdc13j7hr9g1t15
mmjt7cc7fk@.4ax.com...
> On Tue, 30 Aug 2005 11:45:53 -0700, Dusko Vuksanovic wrote:
>
> Hi Dusko,
> I couldn't reproduce it on SP4:
> CREATE FUNCTION dbo.Function1
> ()
> RETURNS INT
> AS
> BEGIN
> RETURN 111
> END
> go
> --TABLE
> /****** Object: Table [dbo].[TktTrack] Script Date: 8/30/2005
> 11:41:54 AM ******/
> CREATE TABLE [dbo].[TktTrack] (
> [IntVal] [int] NOT NULL ,
> [ANum] [int] NOT NULL
> ) ON [PRIMARY]
> GO
> ALTER TABLE [dbo].[TktTrack] WITH NOCHECK ADD
> CONSTRAINT [DF_TktTrack_IntVal] DEFAULT ([dbo].[Function1]())
FOR
> [IntVal]
> GO
> insert TktTrack (IntVal, ANum) values(default, 1)
> go
> select * from TktTrack
> go
> drop table TktTrack
> go
> drop function dbo.Function1
> go
> select @.@.version
> go
> IntVal ANum
> -- --
> 111 1
>
> ---
> Microsoft SQL Server 2000 - 8.00.2039 (Intel X86)
> May 3 2005 23:18:38
> Copyright (c) 1988-2003 Microsoft Corporation
> Personal Edition on Windows NT 5.0 (Build 2195: Service Pack 4)
>
>
> Best, Hugo
> --
> (Remove _NO_ and _SPAM_ to get my e-mail address)|||Wasn't me. Thank Hugo.
Geoff N. Hiten
Senior Database Administrator
Microsoft SQL Server MVP
"Dusko Vuksanovic" <woox@.gmx.com> wrote in message
news:%23ASqlqarFHA.3604@.tk2msftngp13.phx.gbl...
> You are right, Geoff. It works. However, if I manually insert the record
> in SQL Manager, I must refresh it to see the value (this is
> kind of "buggy" behaviour, because it will show 0 at the first place).
> Thanks,
> Dusko
> "Hugo Kornelis" <hugo@.pe_NO_rFact.in_SPAM_fo> wrote in message
> news:jbc9h1pc4jdc13j7hr9g1t15mmjt7cc7fk@.
4ax.com...
>|||On Tue, 30 Aug 2005 14:34:45 -0700, Dusko Vuksanovic wrote:
>You are right, Geoff. It works. However, if I manually insert the record in
SQL Manager, I must refresh it to see the value (this is
>kind of "buggy" behaviour, because it will show 0 at the first place).
Hi Dusko,
Enterprise Manager *IS* buggy when you use it to change data. Don't.
In this case, the most likely explanation is that this is a result of
not having a primary key on the table.
<speculation>
When you insert data in a table through EM, EM will check if any data
gets changed automaGically, so it reads back the row you just inserted.
If the table has a kkey (as all good tables should), EM uses just the
key values to find the row just inserted. But if there's no key, EM has
no choice but to match on all columns.
Of course, since one of the columns gets populated with a value
different from what you entered in EM (that's what the default is for,
of course), EM can't find the row. Only after refreshing the table will
the row show up, as EM will read the complete table when you refresh.
</speculation>
Best, Hugo
--
(Remove _NO_ and _SPAM_ to get my e-mail address)
Does any body have any information how to report a possible SQL Server bug.
I think I found the very interesting one
Thanks,
Dusko Vuksanovic
woox@.gmx.netThis is a good place to start. If it is a new one, I am sure myself or
another MVP will let Microsoft know.
Geoff N. Hiten
Senior Database Administrator
Microsoft SQL Server MVP
"Dusko Vuksanovic" <woox@.gmx.com> wrote in message
news:eYS8MCZrFHA.3216@.TK2MSFTNGP12.phx.gbl...
> Hi People,
> Does any body have any information how to report a possible SQL Server
> bug. I think I found the very interesting one
>
> Thanks,
> Dusko Vuksanovic
> woox@.gmx.net
>|||Ok. Thanks Geoff.
Here is the brief description; I created a simple scalar UDF, and pointed it
to a field in table as "Default Value". Amaizingly,
filled value in the table was always zero (0), instead of the integer value
returned from UDF.
UDF is returning INT value, and field for filling the "Default Value" is INT
too.
By the way, I think I'm having SQL2000 , SP3
Here is the sample TSQL (IntVal shoul always be 111 instead of 0; I cripled
example to be as simple as possible):
--UDF:
CREATE FUNCTION dbo.Function1
()
RETURNS INT
AS
BEGIN
RETURN 111
END
--TABLE
/****** Object: Table [dbo].[TktTrack] Script Date: 8/30/2005 11
:41:54 AM ******/
CREATE TABLE [dbo].[TktTrack] (
[IntVal] [int] NOT NULL ,
[ANum] [int] NOT NULL
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[TktTrack] WITH NOCHECK ADD
CONSTRAINT [DF_TktTrack_IntVal] DEFAULT ([dbo].[Function1]()) FO
R [IntVal]
GO
"Geoff N. Hiten" <sqlcraftsman@.gmail.com> wrote in message news:OLVcuDZrFHA.3596@.TK2MSFTNGP1
5.phx.gbl...
> This is a good place to start. If it is a new one, I am sure myself or
> another MVP will let Microsoft know.
> --
> Geoff N. Hiten
> Senior Database Administrator
> Microsoft SQL Server MVP
> "Dusko Vuksanovic" <woox@.gmx.com> wrote in message
> news:eYS8MCZrFHA.3216@.TK2MSFTNGP12.phx.gbl...
>|||On Tue, 30 Aug 2005 11:45:53 -0700, Dusko Vuksanovic wrote:
>Ok. Thanks Geoff.
>Here is the brief description; I created a simple scalar UDF, and pointed i
t to a field in table as "Default Value". Amaizingly,
>filled value in the table was always zero (0), instead of the integer value
returned from UDF.
>UDF is returning INT value, and field for filling the "Default Value" is IN
T too.
>By the way, I think I'm having SQL2000 , SP3
Hi Dusko,
I couldn't reproduce it on SP4:
CREATE FUNCTION dbo.Function1
()
RETURNS INT
AS
BEGIN
RETURN 111
END
go
--TABLE
/****** Object: Table [dbo].[TktTrack] Script Date: 8/30/2005
11:41:54 AM ******/
CREATE TABLE [dbo].[TktTrack] (
[IntVal] [int] NOT NULL ,
[ANum] [int] NOT NULL
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[TktTrack] WITH NOCHECK ADD
CONSTRAINT [DF_TktTrack_IntVal] DEFAULT ([dbo].[Function1]()) FO
R
[IntVal]
GO
insert TktTrack (IntVal, ANum) values(default, 1)
go
select * from TktTrack
go
drop table TktTrack
go
drop function dbo.Function1
go
select @.@.version
go
IntVal ANum
-- --
111 1
---
Microsoft SQL Server 2000 - 8.00.2039 (Intel X86)
May 3 2005 23:18:38
Copyright (c) 1988-2003 Microsoft Corporation
Personal Edition on Windows NT 5.0 (Build 2195: Service Pack 4)
Best, Hugo
--
(Remove _NO_ and _SPAM_ to get my e-mail address)|||You are right, Geoff. It works. However, if I manually insert the record in
SQL Manager, I must refresh it to see the value (this is
kind of "buggy" behaviour, because it will show 0 at the first place).
Thanks,
Dusko
"Hugo Kornelis" <hugo@.pe_NO_rFact.in_SPAM_fo> wrote in message news:jbc9h1pc4jdc13j7hr9g1t15
mmjt7cc7fk@.4ax.com...
> On Tue, 30 Aug 2005 11:45:53 -0700, Dusko Vuksanovic wrote:
>
> Hi Dusko,
> I couldn't reproduce it on SP4:
> CREATE FUNCTION dbo.Function1
> ()
> RETURNS INT
> AS
> BEGIN
> RETURN 111
> END
> go
> --TABLE
> /****** Object: Table [dbo].[TktTrack] Script Date: 8/30/2005
> 11:41:54 AM ******/
> CREATE TABLE [dbo].[TktTrack] (
> [IntVal] [int] NOT NULL ,
> [ANum] [int] NOT NULL
> ) ON [PRIMARY]
> GO
> ALTER TABLE [dbo].[TktTrack] WITH NOCHECK ADD
> CONSTRAINT [DF_TktTrack_IntVal] DEFAULT ([dbo].[Function1]())
FOR
> [IntVal]
> GO
> insert TktTrack (IntVal, ANum) values(default, 1)
> go
> select * from TktTrack
> go
> drop table TktTrack
> go
> drop function dbo.Function1
> go
> select @.@.version
> go
> IntVal ANum
> -- --
> 111 1
>
> ---
> Microsoft SQL Server 2000 - 8.00.2039 (Intel X86)
> May 3 2005 23:18:38
> Copyright (c) 1988-2003 Microsoft Corporation
> Personal Edition on Windows NT 5.0 (Build 2195: Service Pack 4)
>
>
> Best, Hugo
> --
> (Remove _NO_ and _SPAM_ to get my e-mail address)|||Wasn't me. Thank Hugo.
Geoff N. Hiten
Senior Database Administrator
Microsoft SQL Server MVP
"Dusko Vuksanovic" <woox@.gmx.com> wrote in message
news:%23ASqlqarFHA.3604@.tk2msftngp13.phx.gbl...
> You are right, Geoff. It works. However, if I manually insert the record
> in SQL Manager, I must refresh it to see the value (this is
> kind of "buggy" behaviour, because it will show 0 at the first place).
> Thanks,
> Dusko
> "Hugo Kornelis" <hugo@.pe_NO_rFact.in_SPAM_fo> wrote in message
> news:jbc9h1pc4jdc13j7hr9g1t15mmjt7cc7fk@.
4ax.com...
>|||On Tue, 30 Aug 2005 14:34:45 -0700, Dusko Vuksanovic wrote:
>You are right, Geoff. It works. However, if I manually insert the record in
SQL Manager, I must refresh it to see the value (this is
>kind of "buggy" behaviour, because it will show 0 at the first place).
Hi Dusko,
Enterprise Manager *IS* buggy when you use it to change data. Don't.
In this case, the most likely explanation is that this is a result of
not having a primary key on the table.
<speculation>
When you insert data in a table through EM, EM will check if any data
gets changed automaGically, so it reads back the row you just inserted.
If the table has a kkey (as all good tables should), EM uses just the
key values to find the row just inserted. But if there's no key, EM has
no choice but to match on all columns.
Of course, since one of the columns gets populated with a value
different from what you entered in EM (that's what the default is for,
of course), EM can't find the row. Only after refreshing the table will
the row show up, as EM will read the complete table when you refresh.
</speculation>
Best, Hugo
--
(Remove _NO_ and _SPAM_ to get my e-mail address)
Subscribe to:
Posts (Atom)