--Não é nada de especial. É só uma nota para não fica esquecido.
USE Database
DECLARE @Table_Name nvarchar(200)
DECLARE Table_Cursor CURSOR FOR
SELECT name
FROM sysobjects
WHERE (xtype = 'U')
OPEN Table_Cursor
FETCH NEXT FROM Table_Cursor
INTO @Table_Name
EXEC ('DELETE FROM ' + @Table_Name )
WHILE @@FETCH_STATUS = 0
BEGIN
FETCH NEXT FROM Table_Cursor
INTO @Table_Name
EXEC ('DELETE FROM ' + @Table_Name )
END
CLOSE Table_Cursor
DEALLOCATE Table_Cursor
Tuesday, December 18, 2007
Friday, December 07, 2007
C# procurar strings desprezando os acentos. String search with case and accent insensitive
using System;
using System.Collections.Generic;
using System.Globalization;
public class StringHelper
{
public static int IndexOfWithCaseAndAccentInsensitive (string source, string stringToSearch)
{
CompareInfo ci = new CultureInfo("en-US").CompareInfo;
CompareOptions co = CompareOptions.IgnoreCase | CompareOptions.IgnoreNonSpace;
return ci.IndexOf(source, stringToSearch, co);
}
public static void Main()
{
RL();
WL(IndexOfWithCaseAndAccentuationIncensite("zzzzzzzzzzzÁbc", "a"));
RL();
}
#region Helper methods
private static void WL(object text, params object[] args)
{
Console.WriteLine(text.ToString(), args);
}
private static void RL()
{
Console.ReadLine();
}
private static void Break()
{
System.Diagnostics.Debugger.Break();
}
#endregion
}
Obrigado João, pode vir a ser útil.
using System.Collections.Generic;
using System.Globalization;
public class StringHelper
{
public static int IndexOfWithCaseAndAccentInsensitive (string source, string stringToSearch)
{
CompareInfo ci = new CultureInfo("en-US").CompareInfo;
CompareOptions co = CompareOptions.IgnoreCase | CompareOptions.IgnoreNonSpace;
return ci.IndexOf(source, stringToSearch, co);
}
public static void Main()
{
RL();
WL(IndexOfWithCaseAndAccentuationIncensite("zzzzzzzzzzzÁbc", "a"));
RL();
}
#region Helper methods
private static void WL(object text, params object[] args)
{
Console.WriteLine(text.ToString(), args);
}
private static void RL()
{
Console.ReadLine();
}
private static void Break()
{
System.Diagnostics.Debugger.Break();
}
#endregion
}
Obrigado João, pode vir a ser útil.
Tuesday, December 04, 2007
Subscribe to:
Posts (Atom)