|
Adding a column to a table at a particular location
13/03/2008 10:04:52 AM
(Total replies: 1)
|
| Has anyone tried to add a column at a particular location without the old ...
1. create a temp table based on the original with the columns in the sequence you wish,
2. copy data across
3. delete original table
4. rename new table as original
I (vaguely) recall the ability to modify the column ordering via updates to the sys tables. Is this (still) possible (by either T-SQL or CLR programming)?
All help appreciated.
John |
|
|
|
|
|
|
Re: Adding a column to a table at a particular location
31/07/2008 9:30:05 AM
(Total replies: 0)
|
| Sorry about the long delay, but I finally managed to do this.
And thanks Uri. I did follow your recmomendation of creating a temporary table with the new definition, then copying data across, and then renaming it. Of course, contraints and FKs were troublesome.
|
|
|
|
Re: Should table variables be changed to work IN-MEMORY exclusively?
5/04/2006 2:52:32 PM
(Total replies: 0)
|
| Further to Darren's snippet, table variables aren't subject to transactions (yes, it is true).
That leads me to another 'nice to have'.... autonomous transactions (an Oracle concept). This is great for automated sql jobs that need to be transaction aware but rows inserted into a logging (or instrumentation etc.) table are never affected by the success or failure of the transaction.
John
|
|
|
|
Re: Rowcount revisited
1/06/2005 10:02:48 AM
(Total replies: 1)
|
| On a previous large scale db, I ran across the same issue. After a lot of digging around MS and various SQL sites, I discovered someone figured out the the system tables could be used to retrieve the recordcount rather than querying the table in question.
Try this stored procedure...
Create Procedure dbo.pr_RecordCount
(
@pTableName nvarchar(128)
)
As
Set nocount on
select rows as Count
from sysobjects o inner join sysindexes i on o.id = i.id
where i.indid < 2
and ... |
|
|
|
Re: Caching Objects in ASP.Net
20/05/2005 9:24:33 AM
(Total replies: 0)
|
| Another approach is to cache data using the CacheBlock and expire it at midnight (arbitrary time).
I use a central class that contains a couple of generic DataAccess calls and adds to the Cache with midnight expiry. It exposes a (static) method for each specific dataset/datatable.
The Business Layer uses this class to get the data by calling the specific method for the data it wants ( that's all the BL needs to know).
The cache class will check if it is already cached - great, just ... |
|