Here’s an easy way of extracting ISO dates from a datetime column:
select top 10 convert(varchar(10),starttid, 120) as datum -- style = 120 results in yyyy-mm-dd from pass
Result:
2005-08-02 2005-08-04
Technobabble from a .Net developer on the loose…
Here’s an easy way of extracting ISO dates from a datetime column:
select top 10 convert(varchar(10),starttid, 120) as datum -- style = 120 results in yyyy-mm-dd from pass
Result:
2005-08-02 2005-08-04
When doing an UPDATE and there are two occurrances of the table to update, then use the alias as table name. Example
update alias1 -- NOT the table name! set foo = 'bar' from table_foobar alias1 inner join table_foobar alias2 on alias2.foo = alias1.bar
Here’s a handy way of creating an array and pass it as a parameter for a function call:
MyFunc(new Kommentar[] {kom1, kom2} );
No need for clumsy temporary variables etc. Neat, isn’t it?
Here’s another variation:
VeckoFacit[] facitarr; facitarr = new VeckoFacit[] { new VeckoFacit(...), new VeckoFacit(...), new VeckoFacit(...) };
Initializing a multidimensional array:
int[,] intArray = new int[3, 2] { {1, 2}, {3, 4}, {5, 6} }; int[,] intArray = new int[,] { {1, 2}, {3, 4}, {5, 6} };