EXCELÉú³ÉSQL½¨±í´æ´¢¹ý³ÌµÄVBA½Å±¾
HO~HO~EXCELÉú³ÉSQL½¨±í´æ´¢¹ý³ÌµÄVBA½Å±¾^_^ÔÞÒ»ÏÂ
2007-12-11 10:39
'+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ È«¾Ö±äÁ¿¶¨Òå
Const MAX_COLUMN_NUM = 50
Dim stOutputPath As String
Dim stOutputFile As String
Dim stDBName As String
Dim stUserName As String
Dim stUserPasswd As String
'+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Set InitProcess³õʼ»¯¹ý³Ì
Public Sub InitProcess()
'³õʼ»¯Êä³öÎļþ¼Ð
stOutputPath = Application.ThisWorkbook.Path + "\OUTSQL\"
'³õʼ»¯Êý¾Ý¿âÃû
stDBName = Worksheets("Ê×Ò³").Cells(1, 2).Value
If stDBName = "" Then
MsgBox "Êý¾Ý¿âÃû²»ÄÜΪ¿Õ"
Exit Sub
End If
'³õʼ»¯Êä³öÎļþÃû
stOutputFile = stOutputPath & stDBName & "Create.sql"
'´´½¨Êä³öÎļþ¼ÐandÎļþ
On Error Resume Next
If Dir(stOutputPath) = "" Then
MkDir stOutputPath
End If
Dim FileObj, MyFile
Set FileObj = CreateObject("Scripting.FileSystemObject")
If FileObj.FileExists(stOutputFile) Then
Kill stOutputFile
End If
Set MyFile = FileObj.CreateTextFile(stOutputFile, True)
'³õʼ»¯Óû§Ãû£¬Óû§ÃÜÂë
stUserName = Worksheets("Ê×Ò³").Cells(2, 2).Value
stUserPasswd = Worksheets("Ê×Ò³").Cells(3, 2).Value
End Sub
'+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ´´½¨Êý¾Ý¿âº¯Êý
Public Sub CreateDbSQL(ByVal OutSq
Ïà¹ØÎĵµ£º
Êý¾Ý¿âsqlµÄÌØÊâ×Ö·û£º
1£©µ¥ÒýºÅ’£ºÀýÈçstring a = “this is marry’s book.”;
ʹÓÃinsertʱ¾Í»á³ö´í¡£
½â¾ö£ºa= a.Replace("'","' ......
--½áºÏsys.indexesºÍsys.index_columns,sys.objects,sys.columns²éѯË÷ÒýËùÊôµÄ±í»òÊÓͼµÄÐÅÏ¢
select
o.name as ±íÃû,
i.name as Ë÷ÒýÃû,
c.name as ÁÐÃû,
i.type_desc as ÀàÐÍÃèÊö,
is_primary_key as Ö÷¼üÔ¼Êø,
is_unique_constraint as Î¨Ò»Ô¼Êø,
is_disable ......
Èë Êƪ
Èç¹ûÄãÒÔǰûÊÔ¹ýSQL×¢ÈëµÄ»°£¬ÄÇôµÚÒ»²½ÏȰÑIE²Ëµ¥=>¹¤¾ß=>InternetÑ¡Ïî=>¸ß¼¶=>ÏÔʾÓѺà HTTP ´íÎóÐÅÏ¢Ç°ÃæµÄ¹´È¥µô¡£·ñÔò£¬²»ÂÛ·þÎñÆ÷·µ»ØÊ²Ã´´íÎó£¬IE¶¼Ö»ÏÔʾΪHTTP 500·þÎñÆ÷´íÎ󣬲»ÄÜ»ñµÃ¸ü¶àµÄÌáʾÐÅÏ¢¡£
µÚÒ»½Ú¡¢SQL×¢ÈëÔÀí
ÒÔÏÂÎÒÃÇ´ÓÒ»¸öÍøÕ¾www.19cn.com¿ªÊ¼£¨×¢£º±¾ÎÄ·¢±íǰÒÑÕ÷µ ......
¼ÇÈ¡¼Ç¼¼¯
create procedure getArticle
as
select * from Article_Content
GO
asp.net µ÷Ó÷½·¨
SqlConnection Conn = new SqlConnection();
Conn.ConnectionString = Data.Connstr();
Conn.Open();
......
[code]declare @startdt datetime
declare @enddt datetime
select @startdt='2009-12-03',@enddt='2009-12-05'
select * from tb
where ¿ªÊ¼ÈÕÆÚ between @startdt and @enddt
or ½áÊøÈÕÆÚ between @startdt and @enddt
or @startdt between ¿ªÊ¼ÈÕÆÚ and ½áÊøÈÕÆÚ
or @enddt between ¿ªÊ¼ÈÕÆÚ and ......