Monday, May 31, 2010

TSQL date

declare @StartDate datetime
,@EndDate datetime
set @StartDate = dateadd(d,-1, convert(datetime,convert(varchar(11),getdate(),109),109))
set @EndDate = @StartDate+1
select @StartDate,@EndDate


select * from table
where timevalue >= @StartDate and TimeValue < @EndDate

Sunday, May 30, 2010

jquery

$("select[ID^='Note_']").click(function() {
var currID = $(this).attr("id");
var $options = $('option', $(this));
$options.each(function() {
$(this).text($(this).text() + $(this).attr("title"));
});
});
$("select[ID^='Note_']").bind("blur", function(event) {
//alert($(this).val());
var currID = $(this).attr("id");
var $options = $('option', $(this));
$options.each(function() {
$(this).text($(this).value());
});
});

Friday, May 28, 2010

SELECT DISTINCT

Interesting alternative to using SELECT DISTINCT if you’re loading results into a dataset. The following line creates a DataTable with only distinct rows:

DataTable dtDistinctData = dsData.Tables[0].DefaultView.ToTable(true);