Here are a few Delphi (BDS) Live Templates I created for writting SQL Server script:
Create SQL Server Table
<pre>
version=”1.0.0”>
Create table for SQL Server.
Kirby Turner
TableName
<![CDATA[/***
Create |TableName| table.
***/
PRINT 'Create |TableName| table'
GO
IF (EXISTS (SELECT name FROM sysobjects WHERE (name = N'|TableName|') AND (type = 'U')))
BEGIN
DROP TABLE [dbo].[|TableName|]
END
GO
CREATE TABLE [dbo].[|TableName|] (
|*||end|
|*|CONSTRAINT [PK_|TableName|_1] PRIMARY KEY CLUSTERED
|*|(
|*|)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
GRANT SELECT ON [dbo].[|TableName|] TO [public]
GO]]>
</pre>
Create Foreign Key Reference
<pre>
version=”1.0.0”>
Create foreign key constraint for SQL Server.
Kirby Turner
PrimaryTableName
SecondaryTableName
ColumnName
<![CDATA[ALTER TABLE [dbo].[|PrimaryTableName|] WITH CHECK ADD
CONSTRAINT [FK_|PrimaryTableName|_|SecondaryTableName|] FOREIGN KEY([|ColumnName|])
REFERENCES [dbo].[|SecondaryTableName|] ([|ColumnName|])
GO]]>
</pre>
Enjoy.
Posted in programming. Tagged in delphi, windows.
Related Articles
- Retiring My CSV Editor
- How To Access a Windows 2003 File Share From Mac OS X
- Cannot Resolve Machine Name From Mac OS X
- wuauclt svchost and 100% CPU usgage
- When Naming a Configuration File program.exe.config is Bad
- PowerPoint 2007 and Outlook 2003 Don't Play Nice Together
- VIsta, Reigstry Keys, and UAC
- Windows Vista to Support 7,000+ New Native APIs
- Native Windows Code Is Here for a While
- MSDN Wiki