SQLÎÞÏÞ·ÖÀà´æ´¢¹ý³ÌÕûÀí1
Óŵã:×ֶνÏÉÙ£¬ÓÐÔöɾ¸Ä²é¹¦ÄÜ£¬²»¹ý²éѯ̫Áýͳ¡£
ȱµã:
1.²»ËãÊÇÔÚºÜÕýµÄÎÞÏÞ·ÖÀà,ClassPathÕâ¸ö×ֶζ¨ÒåÏÞÖÆ¡£
2.Ö÷¼üCLASSID²»ÊÇ×ÔÔöµÄ£¬Ê¹ÓÃCODESMITHÅúÁ¿Éú³É¶à²ã¼Ü¹¹´úÂëÖлᵼÖ³ö´í¡£
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[ArticleClass]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[ArticleClass]
GO
CREATE TABLE [dbo].[ArticleClass] (
[ClassID] [int] IDENTITY (1, 1) NOT NULL ,--Ö÷¼ü£¨×¢£º·Ç±êʶ£©
[ClassName] [nvarchar] (50) COLLATE Chinese_Taiwan_Stroke_CI_AS NOT NULL,--·ÖÀàÃû³Æ
[ParentID] [int] NOT NULL ,--¸¸·ÖÀàID£¨Ä¬ÈÏÖµ0£©
[ClassPath] [nvarchar] (1000) COLLATE Chinese_Taiwan_Stroke_CI_AS NOT NULL ,--·ÖÀà·¾¶
[ClassDepth] [int] NOT NULL ,--·ÖÀàÉî¶È(ĬÈÏÖµ0£©
[ClassOrder] [int] NOT NULL ,--·ÖÅÅÐò(ĬÈÏÖµ0)
[ClassDescription] [nvarchar] (1000) COLLATE Chinese_Taiwan_Stroke_CI_AS NULL ,--·ÖÀà˵Ã÷
[iSystem] [int] NULL --ÊÇ·ñÊÇϵͳĬÈÏ·ÖÀà
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[ArticleClass] ADD
CONSTRAINT [DF_ArticleClass_ParentID] DEFAULT (0) FOR [ParentID],
CONSTRAINT [DF_ArticleClass_ClassDepth] DEFAULT (0) FOR [ClassDepth],
CONSTRAINT [DF_ArticleClass_ClassOrder] DEFAULT (0) FOR [ClassOrder],
CONSTRAINT [DF_ArticleClass_iSystem] DEFAULT (0) FOR [iSystem],
CONSTRAINT [PK_ArticleClass] PRIMARY KEY CLUSTERED
(
[ClassID]
) ON [PRIMARY]
GO
exec sp_addextendedproperty N'MS_Description', N'Ö÷¼ü£¨·Ç±êʶ£©', N'user', N'dbo', N'table', N'ArticleClass', N'column', N'ClassID'
GO
exec sp_addextendedproperty N'MS_Description', N'·ÖÀàÃû³Æ', N'user', N'dbo', N'table', N'ArticleClass', N'column', N'ClassName'
GO
exec sp_addextendedproperty N'MS_Description', N'¸¸·ÖÀàID', N'user', N'dbo', N'table', N'ArticleClass', N'column', N'ParentID'
GO
exec sp_addextendedproperty N'MS_Description', N'·ÖÀà·¾¶', N'user', N'dbo', N'table', N'ArticleClass', N'column', N'ClassPath'
GO
exec sp_addextendedpr
Ïà¹ØÎĵµ£º
Ä£·Â²Î¿¼:¶¯Ò×ÎÞÏÞ·ÖÀà
Óŵã:ËãµÃÉÏÊÇÕæÕýµÄÎÞÏÞ·ÖÀ࣬²»¹ýParentPathÊÇÓоÖÏÞÐÔ,ClassIDÊDZêʶÁÐ×Ô¶¯ÔöÒ».
ȱµã:ÐÂÔö¹ý³ÌÖÐParentID²»´æÔÚ»¹Ã»ÓÐÍêÉÆ£¬»á²åÈëNULLÊý¾Ý.ºóÃæÈý¸ö´æ´¢¹ý³Ì»¹ÔÚ²âÊÔ¡£
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[ArticleClass]') and OBJECTPROPERTY(id, N'Is ......
1. ´ò¿ªpl\sql ÔËÐÐÏÂÃæµÄ½Å±¾£¬²éѯ·þÎñÆ÷µÄ×Ö·û¼¯ ¡£
SELECT 'AMERICAN_AMERICA.' || PROPERTY_VALUE
from DATABASE_PROPERTIES
WHERE PROPERTY_NAME = 'NLS_CHARACTERSET';
ÎÒµÄÊÇ AMERICAN_AMERICA.ZHS16GBK
2.ÔÚÔËÐÐÖÐÊäÈ룺regedit£¬´ò¿ª×¢²á±í±à¼Æ÷£»
3.HKEY_LOCAL_MACHI ......
SQLʱ¼ä¶Î²éѯ
ACCESSµÄ»°
select * from table where date1<#2008-1-20# and date2>#2007-8-30#
MYSQLµÄ»°
select * from table where date1<'2008-1-20' and date2>'2007-3-30'
Ò²¿ÉÒÔ
select * from table where date1 between '2008-1-20' and '2007-3-30'
ÆäÖÐdate1,date2¶¼ÊÇÈÕÆÚÀàÐ͵Ä× ......
/*
¸ù¾Ýºº×Ö»ñÈ¡È«Æ´
1.Éú³ÉËùÓжÁÒôÁÙʱ±í
2.¸ù¾ÝChinese_PRC_CS_AS_KS_WS ÅÅÐò»ñÈ¡¶ÁÒô
*/
Create function ChineseSpell(@str varchar(100))
returns varchar(8000)
as
begin
declare @re varchar(8000)
--Éú³ÉÁÙʱ±í
declare @t table(chr nchar(1) collate Chinese_PRC_CS_AS_KS_WS,py nvarchar(20))
ins ......
SqlDataSourceEnumerator instance =SqlDataSourceEnumerator.Instance;
System.Data.DataTable table = instance.GetDataSources();
»ò
System.Data.Sql.SqlDataSourceEnumerator.Instance.GetDataSources();
·µ»ØDatatable
´Ëtable°üº¬ÒÔÏÂËĸö×Ö¶Î
Console.WriteLine("·þÎñÆ÷Ãû = {0}", r ......