|
|
comments (0)
|
Today I needed to generate just the default constraints from a SQL Server database. I naturally started in management studio by right clicking the database and choosing tasks --> Generate scripts. But no matter what options I chose I got either too much cruft or nothing at all. So I had to come up with my own custom script to get what I wanted and I am publishing it here for future use and prosperity ![]()
SELECT
'ALTER TABLE ['
+ t.name
+ '] ADD CONSTRAINT ['
+ o.name
+ '] DEFAULT '
+ isc.COLUMN_DEFAULT
+ ' FOR ['
+ c.name
+ ']'
+ CHAR(13)
+ CHAR(10)
+ 'GO'
FROM
sysobjects o
INNER JOIN syscolumns c ON o.id = c.cdefault
INNER JOIN sysobjects t ON c.id = t.id
INNER JOIN INFORMATION_SCHEMA.COLUMNS isc
ON t.name = isc.TABLE_NAME AND c.name = isc.COLUMN_NAME
WHERE
o.xtype = 'd'
ORDER BY
t.name
|
|
comments (0)
|
Little things like this niggle me. I'm sure they're shortening my life.
|
|
comments (0)
|
So I thought it was about time I checked out Facebook. I don't know why I chose that particular site. There seems to be a new surge in web 2.0, in which it's now possible to program your blogs and sites. Integrating services that exist all over the internet, into little mini plugins. So I have spent an entire evening attempting the Facebook API tutorial. The hardest part was finding a free host that supported PHP version 5. I finaly found one at ByetHost2 The major issue was none of them specified which version of PHP they had installed so I had to sign-up all of them and upload a phpinfo.php file to discover nearly all are still stuck on 4.2 !!!
Anyway having finally got a host on the right version, I completed the tutorial. But, it doesn't work and I am disappointed. It is almost tomorrow and time for bed.