Viewing 15 posts - 211 through 225 (of 568 total)
Check with these statements, is any performance cross, you update last column in the separate statement.
select a.userid , sum(a.Num1)
,(select top 1 b.Num2 from Tmp b where b.userid =...
October 12, 2009 at 2:41 am
txp001 (10/11/2009)
on t1.a = t2.a
The conditions matches the first row in the t2, so that it’s update/ compare the first row data,
Just assumption of update t1 table column-b with...
October 11, 2009 at 10:48 pm
webnoel (10/11/2009)
1900-01-01 15:30:00.000I need it without the Micro seconds.
To get the exact result use the smalldatetime.
declare @date datetime
set @date = getdate()
SELECT @date = cast(DATEADD(D, DATEDIFF(D, @date, 0), @date) as...
October 11, 2009 at 10:07 pm
01)
select id from sale_Invoice
where invoiceDate <= @OnDate
and invoiceDate >= isnull(@OBDate,invoiceDate)
02)
select id from sale_Invoice
where invoiceDate<=@OnDate
and invoiceDate >= case when @OBDate is null then invoiceDate else @OBDate end
03)
October 10, 2009 at 1:16 am
create table #temp
(
col1 varchar(10),
col2 varchar(10),
col3 varchar(10),
col4 varchar(10),
col5 int
)
insert into #temp
select 'A','AA','AAA','KA',10
union all
select 'A','AA','AAA','KB',20
union all
select 'A','AA','AAA','KC',30
union all
select 'B','BB','BBB','LB',40
union all
select 'B','BB','BBB','LC',50
union all
select 'B','BB','BBB','LD',60
select a.col1,a.col2,a.col3,a.col4,a.col5
from #temp a,
(
select a.col1,a.col2,a.col3,max(a.col5)col5
from #temp a
group by a.col1,a.col2,a.col3
)...
October 9, 2009 at 9:23 pm
select a.studentID,a.certID,a.issuedate
from scenario a,
(
select studentID,max(issuedate)issuedate
from scenario
group by studentID
)as b
where a.studentID = b.studentID
and a.issuedate = b.issuedate
order by a.studentID
October 8, 2009 at 11:59 pm
SELECT * FROM VW_SLS
UNION ALL
SELECT * FROM SLS_CURRENT_MONTH
For the permanent scenario, alter the view table.
October 8, 2009 at 9:58 pm
Hi,
just try with
select colA,colB,colC,max(ColF)
from mytable
group by colA,colB,colC
October 8, 2009 at 9:45 pm
declare @result varchar(50)
set @result = 'ssf/sdf/sdf/sf/sf/sf/10/2009'
select replace(@result,'/2009','')
/*ssf/sdf/sdf/sf/sf/sf/10*/
select reverse(replace(@result,'/2009',''))
/*01/fs/fs/fs/fds/fds/fss*/
select patindex('%/%',reverse(replace(@result,'/2009','')))
/*3*/
select left(reverse(replace(@result,'/2009','')),(patindex('%/%',reverse(replace(@result,'/2009',''))))-1)
/*01*/
select reverse (left(reverse(replace(@result,'/2009','')),(patindex('%/%',reverse(replace(@result,'/2009',''))))-1))
/*10*/
October 8, 2009 at 12:57 am
declare @result varchar(50)
set @result = 'dat1/dat2/dat/sd34/dat4/3/2009'
select @result = replace(right(@result,6),'/2009','')
select @result
October 7, 2009 at 1:12 am
RD-201664 (10/6/2009)
select 'there should be a tab between here' + char(9) + 'and here'Ideas?
declare @result varchar(100)
set @result = 'TEST START'+char(9)+'EXEC'+char(9)+'TEST END'
select @result
RESULT
TEST STARTEXECTEST END
set @result = replace(@result,char(9),' -TAB HERE- ')
select...
October 6, 2009 at 9:26 pm
declare @cols as nvarchar(50)
declare @tables as nvarchar(50)
set @cols = 'Name'
set @tables = 'Bank'
if object_id(@tables)>0
begin
if (COLUMNPROPERTY( OBJECT_ID(@tables),@cols,'PRECISION'))>0
begin
select 'PASS'-- your execution statement
end
else
begin
select 'Column Fail'
end
end
else
select 'Table Fail'
October 5, 2009 at 3:51 am
declare @cols as nvarchar(50)
declare @col_name as nvarchar(50)
declare @tables as nvarchar(50)
declare @sql as nvarchar(300)
set @cols = 'Name'--original column name
set @tables = 'Bank'
set @col_name = 'NAME123'-- display column name
set...
October 5, 2009 at 12:26 am
declare @cols as nvarchar(50)
declare @tables as nvarchar(50)
declare @sql as nvarchar(300)
set @cols = 'Name'
set @tables = 'Bank'
set @sql = N'SELECT '+ @cols +' FROM ' + @tables...
October 5, 2009 at 12:11 am
Viewing 15 posts - 211 through 225 (of 568 total)