Viewing 15 posts - 226 through 240 (of 568 total)
kiran_ramisetti (9/24/2009)
current date =2009/09/23
but i have tasks on 21st, 22nd, 25th and 28th of 9th month and 2009
when i select current date(2009/09/23) then...
September 29, 2009 at 9:46 pm
create table #N
(
id int null
)
insert into #N values (null)
insert into #N values (1)
insert into #N values (2)
select
sum(isnull(id,0))[total sum],
count(id)[total Valid row],
count(isnull(id,0))[total row]
from #n
select isnull(cast(id as varchar),'N/A')[id] from #n
September 29, 2009 at 9:18 pm
David-155102 (9/29/2009)
I can see is that the possible divide by zero is not being handled.
Handle the divided by zero error for this statement by
from #Temp
group by id, item, f_year...
September 29, 2009 at 1:10 am
select id, item, f_year,
sum(case when f_month = 01 then qty else 0 end)/sum(qty)*100 as 'P1',
...
September 28, 2009 at 11:58 pm
WebTechie38 (9/28/2009)
I would like the actual rows returned.
Hi,
Some of the parameter you declared for the dynamically sql may leave it as null i.e. your not set the value for all...
September 28, 2009 at 11:16 pm
declare @result varchar(20)
select @result = 'testdb/sysdb'
select PATINDEX('%/%',@result)
select left(@result,PATINDEX('%/%',@result))
select replace(@result,left(@result,PATINDEX('%/%',@result)),'')
September 25, 2009 at 10:38 pm
svenk7 (9/25/2009)
@table_name varchar(50)
as
declare @countint
declare @d_code varchar(500)
SET @d_code = (Select dcode from t1 where field_name = @field_name)
If @table_name = 'tw_STK_Import'
begin
set @count = (select...
September 25, 2009 at 9:39 pm
Compile of the SP in different DB from a statement.
This may be done by using of the dynamic sql statement.
However show your existing used statement that will help to better...
September 25, 2009 at 9:23 pm
kabi (9/25/2009)
Select * from tablename order by schooltname desc,state ,city
Bit modify the kabi code
select IDENTITY(int, 1,1) AS [ID],schooltname, state, distict, city into #MYTABLE from MYTABLE
order by schooltname desc,state ,city
select...
September 25, 2009 at 1:15 am
Use of the distinct to avoid the same value repeated (duplicate) records in the full rows,
And try this
select distinct
isnull(d.[name],'Unknown')as depot_name
,isnull(d.,'Unknown') as depot_code
, d.[status]
,cast(floor(cast(d.[last_date] as float)) as smalldatetime)as last_date
FROM [dbo].[Depot]...
September 25, 2009 at 1:00 am
exec sp_MSforeachdb "select '?' As DatabaseName,name from ?.dbo.sysobjects where name like ('%MYTABLE%')"
September 24, 2009 at 4:00 am
The data range error, depends on the type of the date we have stored
1)Date only.
2)Date with time.
For all situations, I preferred the method like
Select column1
from myTable
where date >=...
September 23, 2009 at 9:28 pm
Single DB
select databasepropertyex('MY_DB', N'collation')
All DB
EXEC sp_msForEachDB ' select databasepropertyex(''?'', N''collation'') '
September 22, 2009 at 9:48 pm
Dave Ballantyne (9/22/2009)
select Job ,Name1_1 ,city1_1 , phone1_1
from table
union all
select Job ,Name1_2 ,city1_2 , phone1_2
from table
union all
select Job ,Name1_3 ,city1_3 , phone1_3
from table
union all...
September 22, 2009 at 4:41 am
[Code]
select a.sort, a.type, max(a.Date), b.Price, a.Name
from @tbl a
inner join (select sort, type, max(Price) Price
from @tbl
group by sort, type, Name) B
on a.Sort = b.Sort
and a.Type = b.type
and a.Price =...
September 22, 2009 at 4:18 am
Viewing 15 posts - 226 through 240 (of 568 total)