Wednesday, February 25, 2009

How to add a constraint on a table that has 2 iD columns

How to add a constraint on a table that has 2 iD columns
The idea is that both id columns have allow nulls, but you would like to have an ID at least in one of them all the time.

This is how you do it:





ALTER TABLE [PTCTSS_FactorGroup] ADD
CONSTRAINT [CK_PTCTSS_FactorGroup_2cols] CHECK (((not([ContractSectionId] is null))) or ((not([CustomModuleId] is null))))
GO





Thanks 2 Cris ;)

Thursday, February 5, 2009

Dos - glue (sql) files together

I wanted to concatenate files together
I had like 20 sql files
I knew there had to be a way ... other than the "hard" way.

Romica helped me out ;)

this is what he did:
opened a CMD
and go:

type *.sql >> t.sql

done

Wednesday, February 4, 2009

innerHTML not working in ie7

I had a bug
It looked like innerHTML is not working in ie7.
It was somthing like this:
function ShowLblError(msg)
{
document.getElementById("<%=lblError.ClientID%>").innerHTML = msg;
}

It worked fine in IE6, but not in IE7.
Finally I found out that it is working in IE7 too, I just had a panel with some weird height (it was ok in in IE6, ugly in IE7), and I just couldn't see the Label.

So innerHTML IS working in ie7
:)