<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:pingback="http://madskills.com/public/xml/rss/module/pingback/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0">
  <channel>
    <title>Return to LifeAsBob - SQL Server | SSMS</title>
    <link>http://www.lifeasbob.com/</link>
    <description>Horkay Blog</description>
    <language>en-us</language>
    <copyright>Robert J. Horkay</copyright>
    <lastBuildDate>Wed, 14 Jan 2009 15:13:13 GMT</lastBuildDate>
    <generator>newtelligence dasBlog 2.0.7226.0</generator>
    <managingEditor>bobh@lifeasbob.com</managingEditor>
    <webMaster>bobh@lifeasbob.com</webMaster>
    <item>
      <trackback:ping>http://www.lifeasbob.com/Trackback.aspx?guid=f1d437b1-8dc0-422b-9b72-8ad3660c5888</trackback:ping>
      <pingback:server>http://www.lifeasbob.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.lifeasbob.com/PermaLink,guid,f1d437b1-8dc0-422b-9b72-8ad3660c5888.aspx</pingback:target>
      <dc:creator>Bob Admin</dc:creator>
      <wfw:comment>http://www.lifeasbob.com/CommentView,guid,f1d437b1-8dc0-422b-9b72-8ad3660c5888.aspx</wfw:comment>
      <wfw:commentRss>http://www.lifeasbob.com/SyndicationService.asmx/GetEntryCommentsRss?guid=f1d437b1-8dc0-422b-9b72-8ad3660c5888</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
Altering a table column from varchar to datetime is pretty straight-forward in the
SQL Server Management Studio (SSMS), until you look at the tsql generated.  For
many operations SSMS will generate a tsql script that will:
</p>
        <ul>
          <li>
create a temporary table 
</li>
          <li>
drop all the foreign keys 
</li>
          <li>
copy the data to the temporary table 
</li>
          <li>
create the new table with the correct data type 
</li>
          <li>
copy the data to the new table 
</li>
          <li>
drop the temporary table 
</li>
          <li>
add the foreign keys back</li>
        </ul>
        <p>
That is a lot of operations and on a really large table of millions of rows may take
a very long time to complete.
</p>
        <p>
SQLCricket comments that it is possible to change the options in SSMS to warn on table
operations, i think this is only in sql 2K8.
</p>
        <p>
SQLPuma comments that it is possible to change a varchar() to a datetime via tsql
with an alter table alter column command.
</p>
        <p>
In this particular case we were modifying a varchar(10) to a datetime.  All the
data was in a valid format.  The easiest method is to alter the column,
another method to complete this is to:
</p>
        <ul>
          <li>
rename the existing column (tmp_varchar etc) 
</li>
          <li>
add a new column with the correct name 
</li>
          <li>
update the new column (in batches if necessary) 
</li>
          <li>
drop the original column (now with a tmp_name)</li>
        </ul>
        <p>
This is very quick, much safer operation and is much "nicer" to the database log file. 
Example of tsql is below:
</p>
        <pre>
          <span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">
            <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">CREATE</span>
            <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">TABLE</span> dbo.testing
(test_id <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">bigint</span><span style="FONT-SIZE: 11px; COLOR: silver; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">NOT</span><span style="FONT-SIZE: 11px; COLOR: silver; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">NULL</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">IDENTITY</span> (1,
1) <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">primary</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">key</span>,
some_dt <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">varchar</span>(10)
) GO <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">insert</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">into</span> testing
(some_dt) <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">values</span> (<span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">'2009-01-01'</span>) <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">insert</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">into</span> testing
(some_dt) <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">values</span> (<span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">'2009-01-02'</span>) <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">insert</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">into</span> testing
(some_dt) <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">values</span> (<span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">'2009-01-03'</span>) <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">insert</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">into</span> testing
(some_dt) <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">values</span> (<span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">'2009-01-04'</span>)
go <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">EXECUTE</span> sp_rename <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">'dbo.testing.some_dt'</span>,
    <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">'Tmp_some_dt'</span>, <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">'COLUMN'</span> GO <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">Alter</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">Table</span> testing <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">Add</span> some_dt <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">DateTime</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">Default</span>(<span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">'1900-01-01'</span>) <span style="FONT-SIZE: 11px; COLOR: silver; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">NOT</span><span style="FONT-SIZE: 11px; COLOR: silver; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">NULL</span> GO <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">Update</span> testing
    <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">Set</span> some_dt
= <span style="FONT-SIZE: 11px; COLOR: fuchsia; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">Convert</span>(<span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">DateTime</span>,Tmp_some_dt)
GO <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">Alter</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">Table</span> testing
    <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">DROP</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">Column</span> Tmp_some_dt
GO <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">select</span> * <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">from</span> testing
go <span style="FONT-SIZE: 11px; COLOR: teal; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">--drop
table testing</span></span>
        </pre>
        <img width="0" height="0" src="http://www.lifeasbob.com/aggbug.ashx?id=f1d437b1-8dc0-422b-9b72-8ad3660c5888" />
      </body>
      <title>Alter varchar to datetime</title>
      <guid isPermaLink="false">http://www.lifeasbob.com/PermaLink,guid,f1d437b1-8dc0-422b-9b72-8ad3660c5888.aspx</guid>
      <link>http://www.lifeasbob.com/2009/01/14/AlterVarcharToDatetime.aspx</link>
      <pubDate>Wed, 14 Jan 2009 15:13:13 GMT</pubDate>
      <description>&lt;p&gt;
Altering a table column from varchar to datetime is pretty straight-forward in the
SQL Server Management Studio (SSMS), until you look at the tsql generated.&amp;nbsp; For
many operations SSMS will generate a tsql script that will:
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
create a temporary table 
&lt;li&gt;
drop all the foreign keys 
&lt;li&gt;
copy the data to the temporary table 
&lt;li&gt;
create the new table with the correct data type 
&lt;li&gt;
copy the data to the new table 
&lt;li&gt;
drop the temporary table 
&lt;li&gt;
add the foreign keys back&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
That is a lot of operations and on a really large table of millions of rows may take
a very long time to complete.
&lt;/p&gt;
&lt;p&gt;
SQLCricket comments that it is possible to change the options in SSMS to warn on table
operations, i think this is only in sql 2K8.
&lt;/p&gt;
&lt;p&gt;
SQLPuma comments that it is possible to change a varchar() to a datetime via tsql
with an alter table alter column command.
&lt;/p&gt;
&lt;p&gt;
In this particular case we were modifying a varchar(10) to a datetime.&amp;nbsp; All the
data was in a valid format.&amp;nbsp;&amp;nbsp;The easiest method is to alter the column,
another&amp;nbsp;method to complete this is to:
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
rename the existing column (tmp_varchar etc) 
&lt;li&gt;
add a new column with the correct name 
&lt;li&gt;
update the new column (in batches if necessary) 
&lt;li&gt;
drop the original column (now with a tmp_name)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
This is very quick, much safer operation and is much "nicer" to the database log file.&amp;nbsp;
Example of tsql is below:
&lt;/p&gt;
&lt;pre&gt;&lt;span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;CREATE&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;TABLE&lt;/span&gt; dbo.testing
(test_id &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;bigint&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: silver; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;NOT&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: silver; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;NULL&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;IDENTITY&lt;/span&gt; (1,
1) &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;primary&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;key&lt;/span&gt;,
some_dt &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;varchar&lt;/span&gt;(10)
) GO &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;insert&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;into&lt;/span&gt; testing
(some_dt) &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;values&lt;/span&gt; (&lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;'2009-01-01'&lt;/span&gt;) &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;insert&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;into&lt;/span&gt; testing
(some_dt) &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;values&lt;/span&gt; (&lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;'2009-01-02'&lt;/span&gt;) &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;insert&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;into&lt;/span&gt; testing
(some_dt) &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;values&lt;/span&gt; (&lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;'2009-01-03'&lt;/span&gt;) &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;insert&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;into&lt;/span&gt; testing
(some_dt) &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;values&lt;/span&gt; (&lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;'2009-01-04'&lt;/span&gt;)
go &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;EXECUTE&lt;/span&gt; sp_rename &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;'dbo.testing.some_dt'&lt;/span&gt;,
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;'Tmp_some_dt'&lt;/span&gt;, &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;'COLUMN'&lt;/span&gt; GO &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;Alter&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;Table&lt;/span&gt; testing &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;Add&lt;/span&gt; some_dt &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;DateTime&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;Default&lt;/span&gt;(&lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;'1900-01-01'&lt;/span&gt;) &lt;span style="FONT-SIZE: 11px; COLOR: silver; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;NOT&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: silver; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;NULL&lt;/span&gt; GO &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;Update&lt;/span&gt; testing
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;Set&lt;/span&gt; some_dt
= &lt;span style="FONT-SIZE: 11px; COLOR: fuchsia; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;Convert&lt;/span&gt;(&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;DateTime&lt;/span&gt;,Tmp_some_dt)
GO &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;Alter&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;Table&lt;/span&gt; testing
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;DROP&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;Column&lt;/span&gt; Tmp_some_dt
GO &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;select&lt;/span&gt; * &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;from&lt;/span&gt; testing
go &lt;span style="FONT-SIZE: 11px; COLOR: teal; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;--drop
table testing&lt;/span&gt; &lt;/span&gt;&lt;/pre&gt;
&lt;img width="0" height="0" src="http://www.lifeasbob.com/aggbug.ashx?id=f1d437b1-8dc0-422b-9b72-8ad3660c5888" /&gt;</description>
      <comments>http://www.lifeasbob.com/CommentView,guid,f1d437b1-8dc0-422b-9b72-8ad3660c5888.aspx</comments>
      <category>SQL Server</category>
      <category>SQL Server / SSMS</category>
    </item>
    <item>
      <trackback:ping>http://www.lifeasbob.com/Trackback.aspx?guid=a4878b19-a0c2-436b-a3dd-304d7d4852b2</trackback:ping>
      <pingback:server>http://www.lifeasbob.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.lifeasbob.com/PermaLink,guid,a4878b19-a0c2-436b-a3dd-304d7d4852b2.aspx</pingback:target>
      <dc:creator>Bob Admin</dc:creator>
      <wfw:comment>http://www.lifeasbob.com/CommentView,guid,a4878b19-a0c2-436b-a3dd-304d7d4852b2.aspx</wfw:comment>
      <wfw:commentRss>http://www.lifeasbob.com/SyndicationService.asmx/GetEntryCommentsRss?guid=a4878b19-a0c2-436b-a3dd-304d7d4852b2</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
Nothing more annoying than something that should, but doesn't work.
</p>
        <p>
Often we allow users to view jobs (not necessarily administer), but just the ability
to go view them etc.
</p>
        <p>
Generally this was granted through the TargetServerRole in the msdb database. 
Works fine in sql server 2000 enterprise manager, but with SQL Server Management Studio
connecting to a sql server 2000 Instance, it does not work.
</p>
        <p>
Best we can tell this is related to a "Phantom" 208 error.  A 208 error is generated
when one compiles a stored procedure which declares and uses a temporary table.
</p>
        <p>
          <a href="http://www.mcse.ms/printthread.php?threadid=1265640">http://www.mcse.ms/printthread.php?threadid=1265640</a>
        </p>
        <p>
Though if you run a trace profile everything completes fine, but some how ssms "sees"
the 208 error and "throws" an error.
</p>
        <p>
Unfortunately many users are not adept enough to run the commands through TSQL, they
need a GUI.
</p>
        <p>
So far the only solution was to install sql server 2000 client tools, which we were
hoping to only have to install sql server 2005 client tools.
</p>
        <p>
 
</p>
        <p>
          <br />
 
</p>
        <img width="0" height="0" src="http://www.lifeasbob.com/aggbug.ashx?id=a4878b19-a0c2-436b-a3dd-304d7d4852b2" />
      </body>
      <title>Allow users to view jobs, TargetServersRole bug in SQL Server 2005</title>
      <guid isPermaLink="false">http://www.lifeasbob.com/PermaLink,guid,a4878b19-a0c2-436b-a3dd-304d7d4852b2.aspx</guid>
      <link>http://www.lifeasbob.com/2008/01/02/AllowUsersToViewJobsTargetServersRoleBugInSQLServer2005.aspx</link>
      <pubDate>Wed, 02 Jan 2008 20:13:51 GMT</pubDate>
      <description>&lt;p&gt;
Nothing more annoying than something that should, but doesn't work.
&lt;/p&gt;
&lt;p&gt;
Often we allow users to view jobs (not necessarily administer), but just the ability
to go view them etc.
&lt;/p&gt;
&lt;p&gt;
Generally this was granted through the TargetServerRole in the msdb database.&amp;nbsp;
Works fine in sql server 2000 enterprise manager, but with SQL Server Management Studio
connecting to a sql server 2000 Instance, it does not work.
&lt;/p&gt;
&lt;p&gt;
Best we can tell this is related to a "Phantom" 208 error.&amp;nbsp; A 208 error is generated
when one compiles a stored procedure which declares and uses a temporary table.
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://www.mcse.ms/printthread.php?threadid=1265640"&gt;http://www.mcse.ms/printthread.php?threadid=1265640&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
Though if you run a trace profile everything completes fine, but some how ssms "sees"
the 208 error and "throws" an error.
&lt;/p&gt;
&lt;p&gt;
Unfortunately many users are not adept enough to run the commands through TSQL, they
need a GUI.
&lt;/p&gt;
&lt;p&gt;
So far the only solution was to install sql server 2000 client tools, which we were
hoping to only have to install sql server 2005 client tools.
&lt;/p&gt;
&lt;p&gt;
&amp;nbsp;
&lt;/p&gt;
&lt;p&gt;
&lt;br&gt;
&amp;nbsp;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.lifeasbob.com/aggbug.ashx?id=a4878b19-a0c2-436b-a3dd-304d7d4852b2" /&gt;</description>
      <comments>http://www.lifeasbob.com/CommentView,guid,a4878b19-a0c2-436b-a3dd-304d7d4852b2.aspx</comments>
      <category>SQL Server / SSMS</category>
    </item>
    <item>
      <trackback:ping>http://www.lifeasbob.com/Trackback.aspx?guid=7526c608-21a1-40ee-a810-298d12d1b17d</trackback:ping>
      <pingback:server>http://www.lifeasbob.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.lifeasbob.com/PermaLink,guid,7526c608-21a1-40ee-a810-298d12d1b17d.aspx</pingback:target>
      <dc:creator>Bob Admin</dc:creator>
      <wfw:comment>http://www.lifeasbob.com/CommentView,guid,7526c608-21a1-40ee-a810-298d12d1b17d.aspx</wfw:comment>
      <wfw:commentRss>http://www.lifeasbob.com/SyndicationService.asmx/GetEntryCommentsRss?guid=7526c608-21a1-40ee-a810-298d12d1b17d</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
Recently I ran into an issue using SQL Server management Studio to edit a SQL Agent
scheduled job.
</p>
        <p>
Specifically the business requirement was to have a job run every 87 minutes. 
When I went to edit the job, it would let me type in 87 minutes but when you tabbed
off or saved, it changed to 60 minutes!
</p>
        <p>
Ended up having to edit this using TSQL, disabling the current schedule and adding
a new schedule that was set for 87 minutes, runs and works no problem, you just can't
edit it through the GUI.
</p>
        <p>
Thankyou SQL Server Management Studio.
</p>
        <img width="0" height="0" src="http://www.lifeasbob.com/aggbug.ashx?id=7526c608-21a1-40ee-a810-298d12d1b17d" />
      </body>
      <title>Job Schedule greater than 60 minutes</title>
      <guid isPermaLink="false">http://www.lifeasbob.com/PermaLink,guid,7526c608-21a1-40ee-a810-298d12d1b17d.aspx</guid>
      <link>http://www.lifeasbob.com/2007/11/12/JobScheduleGreaterThan60Minutes.aspx</link>
      <pubDate>Mon, 12 Nov 2007 19:06:28 GMT</pubDate>
      <description>&lt;p&gt;
Recently I ran into an issue using SQL Server management Studio to edit a SQL Agent
scheduled job.
&lt;/p&gt;
&lt;p&gt;
Specifically the business requirement was to have a job run every 87 minutes.&amp;nbsp;
When I went to edit the job, it would let me type in 87 minutes but when you tabbed
off or saved, it changed to 60 minutes!
&lt;/p&gt;
&lt;p&gt;
Ended up having to edit this using TSQL, disabling the current schedule and adding
a new schedule that was set for 87 minutes, runs and works no problem, you just can't
edit it through the GUI.
&lt;/p&gt;
&lt;p&gt;
Thankyou SQL Server Management Studio.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.lifeasbob.com/aggbug.ashx?id=7526c608-21a1-40ee-a810-298d12d1b17d" /&gt;</description>
      <comments>http://www.lifeasbob.com/CommentView,guid,7526c608-21a1-40ee-a810-298d12d1b17d.aspx</comments>
      <category>SQL Server / SSMS</category>
    </item>
  </channel>
</rss>