Viewing 15 posts - 256 through 270 (of 568 total)
neo_pom (9/9/2009)
If a column keeps email address look like thesep@hotmail.com;a@hotmail.com
I'd like count '@' in the column
How can I write TSQL just only one statement(without loop) to do that ?
Hi,
Suppose...
September 9, 2009 at 11:34 pm
Hi,
The 1.5, 1.3 is the Integer (whole number)?
Use the ROUND OFF Method.
Round (col2, 1)
September 6, 2009 at 11:38 pm
Hi,
Is be very sure that the sequence of records change means some records were removed from the table?
Try with this table output
select * from master..syscacheobjects
where objtype = 'ADHOC'
September 2, 2009 at 3:18 am
Hi,
Try this
create table #temp1
(
id1 int null,
id2 varchar(10) null,
id3 int null,
id4 int null
)
insert into #temp1
select null,'TEST',null,null
union all
select 1,'REAL',2,3
union all
select 2,'REAL1',3,4
union all
select 1,null,2,3
union all
select 1,'TEST',2,null
01)
select * from #temp1
where id1 is not null
and...
September 2, 2009 at 2:36 am
Hi,
try this
create table TAB1
(
col char(2)
)
insert into TAB1
select 'A'
union all
select 'B'
union all
select 'C'
union all
select 'D'
create table TAB2
(
col1 char(2),
col2 char(2),
col3 char(2),
col4 char(2)
)
DECLARE @TAB1 VARCHAR(100),@SQL Nvarchar(500)
SELECT @TAB1 = COALESCE(@TAB1+''',''' , '') +...
September 1, 2009 at 3:42 am
Repeated post, discussions already started in
September 1, 2009 at 12:31 am
Hi,
try this
select x.*,y.date as [date]
from
(
select sort,type,Max(price)price,name from @tbl
group by sort,type,name
) as X
left outer join
@tbl Y
on x.sort = y.sort
and x.type = y.type
and x.name = y.name
and...
August 31, 2009 at 11:47 pm
Hi,
complie this statement
and getback with the result
declare @month int,@year int,@DATE varchar(15)
select @month = 8,@year = 2009
set @DATE = (cast(@year as varchar)+'-'+cast(@month as varchar)+'-'+'01')
select @DATE
SELECT DAY(DATEADD(day,7+7-DATEPART(dw,(cast(@year as varchar)+'-'+cast(@month as varchar)+'-'+'01')),
(cast(@year...
August 27, 2009 at 1:32 am
Hi,
Just modify David Burrows coding posted in the same question early
SET DATEFIRST 1
CREATE function get_2_sunday
(
@month int,
@year int
)
RETURNS INT
as
begin
declare @day int
SELECT @day = DAY(DATEADD(day,7+7-DATEPART(dw,(cast(@year as varchar)+'-'+cast(@month as varchar)+'-'+'01')),
(cast(@year as varchar)+'-'+cast(@month...
August 27, 2009 at 1:10 am
Hi,
--IN SQL
CREATE PROC proc1
@i int
AS
BEGIN
WHILE @i > 0
BEGIN
print 'SQL WHILE TESTING'
SELECT @i = @i-1
END
END
--IN ORACLE
CREATE OR REPLACE PROCEDURE proc1
(iv_i IN NUMBER)
AS
v_i NUMBER(10,0) :=iv_i;
BEGIN
WHILE v_i > 0
LOOP
BEGIN
DBMS_OUTPUT.PUT_LINE('ORACLE WHILE TESTING');
v_i := v_i...
August 26, 2009 at 12:21 am
HI,
TRY THIS
select getdate() + (1 - DAY(getdate()))
select DATENAME(weekday,(getdate() + 1 - DAY(getdate())))
August 25, 2009 at 11:17 pm
Hi Leo,
For the new queries, please put in to the new topic,
Because lot of voluntaries notice the topic and give their best idea.
August 25, 2009 at 4:52 am
Hi,
Change the year to current year because Birth date comes every year,
then do the date different
like
create table #emp
(
ID1 int,
name1 varchar(10),
DOB varchar(12))
insert into #emp
select 101,'JOHN','27/08/1975'
union all
select 102,'JOH','28/09/1975'
union all
select 103,'JO','29/10/1975'
select *,(datediff
(day,
getdate(),
(convert(datetime,replace(DOB,right(DOB,4),(year(getdate()))),103))))AS no_of_days
...
August 25, 2009 at 12:39 am
Hi,
try with the case when statement
select * from Store.STIPR,Store.STCategory where
iprdate = (case when @IPRdate is null then iprdate else @IPRdate end) and
iprno = (case when @IPRNo is null then iprno...
August 24, 2009 at 11:45 pm
hi,
its the varchar column so change& update with the substring
like
create table #temp
( slno int,
date1 varchar(15)
)
insert into #temp
select 1,'01/12/2008'
union all
select 2,'05/12/2008'
union all
select 3,'10/12/2008'
union all
select 4,'15/12/2008'
union all
select 5,'20/12/2008'
union all
select 6,'25/12/2008'
union all
select 7,'30/12/2008'
select...
August 22, 2009 at 4:24 am
Viewing 15 posts - 256 through 270 (of 568 total)