Skip to content
Simon Kurowski edited this page Feb 14, 2017 · 4 revisions

Welcome to the hello-world wiki!

So kann man das machen:

select DATEPART(yyyy, '2015-01-13')  -- 2015
select DATEPART(m, '2015-01-13')  -- 01
select DATEPART(d, '2015-01-13')  -- 13

Auch C# sollte gehen:

using (SqlConnection conn = new SqlConnection("Server=dbserver;Database=db;Integrated Security=true;"))
{
    conn.Open();
 
    using (SqlCommand command = conn.CreateCommand())
    {
        command.CommandTimeout = 300;
        command.CommandText = sql;
 
        using (SqlDataReader dtr = command.ExecuteReader())
        {
             while (dtr.Read())
             {
                 Console.WriteLine(items[0] + " " + items[1] + " " + items[2] + " " + dtr["Code"] + " " + dtr[items[1]]);
             }
        }
    }
}
Clone this wiki locally