MSSQL:
ALTER TABLE TableName ADD ColumnName NVARCHAR(50)
--定義Cursor
DECLARE MyCursor Cursor FOR
SELECT [FieldTypeName] FROM [CRM_Test].[dbo].[FieldType]
--開啟Cursor
Open MyCursor
--定義接收變數
DECLARE @FieldTypeName nvarchar(50)
--迴圈跑Cursor
Fetch NEXT FROM MyCursor INTO @FieldTypeName
While (@@FETCH_STATUS = 0)
BEGIN
print @FieldTypeName
Fetch NEXT FROM MyCursor INTO @FieldTypeName
END
--關閉及釋放cursor
CLOSE MyCursor
DEALLOCATE MyCursor
運用陣列的length屬性來判斷:
if ($("#myid").length > 0) {
//do something
}
運用getElementById方法來判斷:
if (document.getElementById("myid")) {
//do something
}
常用:
Select CONVERT(varchar(100), GETDATE(), 12) --060516
Select CONVERT(varchar(100), GETDATE(), 20) --2006-05-16 10:57:47
Select CONVERT(varchar(100), GETDATE(), 23) --2006-05-16
Select CONVERT(varchar(100), GETDATE(), 24) --10:57:47
Select CONVERT(varchar(100), GETDATE(), 8) --10:57:46
Select CONVERT(varchar(100), GETDATE(), 108) --10:57:49
public static void Main()
{
string[] conditions = new string[]{ "ABC", "DEF" };
string target1 = "ABCXYZDEFIJK"; //符合 ABC DEF
string target2 = "HGFPOIKJGLKHUNSD"; //完全不符合
string target3 = "POIUYTREABC"; //符合 ABC
string target4 = "MNBFDRGHDEFPOKHVGYV"; //符合 DEF
var result1 = conditions.Any(x=>target1.Contains(x));
Console.WriteLine("Target1 Result: {0}", result1);
var result2 = conditions.Any(x=>target2.Contains(x));
Console.WriteLine("Target2 Result: {0}", result2);
var result3 = conditions.Any(x=>target3.Contains(x));
Console.WriteLine("Target3 Result: {0}", result3);
var result4 = conditions.Any(x=>target4.Contains(x));
Console.WriteLine("Target4 Result: {0}", result4);
}
執行結果:
Target1 Result: True
Target2 Result: False
Target3 Result: True
Target4 Result: True