# ActiveRecord and SQL Server

**URL:** <https://www.ruby-forum.com/t/activerecord-and-sql-server/59606>\
**Category:** Rails\
**Created:** [May 4, 2006, 4:38pm UTC](https://www.ruby-forum.com/t/activerecord-and-sql-server/59606 "2006-05-04T16:38:00Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ed\_Silva](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/90ced4/32.png) [@Ed\_Silva](https://www.ruby-forum.com/u/Ed_Silva)\
**Post date:** [May 4, 2006, 4:38pm UTC](https://www.ruby-forum.com/t/activerecord-and-sql-server/59606/1 "2006-05-04T16:38:00Z")

</div>

Hi all,

I am exploring using RoR for a new project but have run into a  
problem with ActiveRecord and SQL Server’s timestamp datatype.

We have a NOT NULL timestamp column in a table and ActiveRecord keeps  
trying to update it, which promptly causes it to blow up. I have  
tried making the value NULL for insert and update in the model, but  
SQL Server doesn’t like that either.

Is there any way to get ActiveRecord to just completely ignore that  
column short of using a view to hide it?

Cheers,

–Ed

---

<div class="post-metadata">

**Author:** ![Ed\_Silva](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/90ced4/32.png) [@Ed\_Silva](https://www.ruby-forum.com/u/Ed_Silva)\
**Post date:** [May 4, 2006, 4:38pm UTC](https://www.ruby-forum.com/t/activerecord-and-sql-server/59606/2 "2006-05-04T16:38:06Z")

</div>

What is the name of the column?

```
 Erik.

```

Ed Silva schreef:

---

<div class="post-metadata">

**Author:** ![Ed\_Silva](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/90ced4/32.png) [@Ed\_Silva](https://www.ruby-forum.com/u/Ed_Silva)\
**Post date:** [May 5, 2006, 3:59pm UTC](https://www.ruby-forum.com/t/activerecord-and-sql-server/59606/3 "2006-05-05T15:59:08Z")

</div>

On 5/4/06, Ed Silva [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Is there any way to get ActiveRecord to just completely ignore that  
> column short of using a view to hide it?

Off the top of my head, something like this may work:

class Record \< ActiveRecord::Base  
def self.columns  
super.reject {|c| c.name == “timestamp”}  
end  
end

Tom

---

<div class="post-metadata">

**Author:** ![Ed\_Silva](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/90ced4/32.png) [@Ed\_Silva](https://www.ruby-forum.com/u/Ed_Silva)\
**Post date:** [May 5, 2006, 4:36pm UTC](https://www.ruby-forum.com/t/activerecord-and-sql-server/59606/4 "2006-05-05T16:36:03Z")

</div>

This did the trick, thanks! Now I won’t have to use perl for this  
project! 🙂

Cheers,

–Ed
