Viewing 6 posts - 1 through 6 (of 6 total)
Check this this will help you out, with out CTE
Create table #Demo
(
cl varchar(10), c2 varchar(10), c3 varchar(10)
)
insert into #Demo values('t_a', 'cd_1', 'com_1')
insert into #Demo values('t_a', ...
April 6, 2010 at 11:02 pm
Here is the updated script with careindex
select DDate, Sum(Charindex('Debit',Type) * Amount) AS Debit,
Sum(Charindex('Credit', Type) * Amount) AS Credit
From #Demo
group by Ddate
It will transpose rows into column (like pivot).
this can be...
April 6, 2010 at 10:01 pm
Sorry Instead of Instr we can use CHARINDEX.
Regards
Hariprasad
April 6, 2010 at 1:20 am
Thanks paul, that was good one.
regards
Hari
February 22, 2010 at 10:45 pm
Hi,
Try this,
SELECT CAST(CAST(1.67574 AS DECIMAL(38,10)) / CAST(10000 AS DECIMAL(38,10)) AS DECIMAL(38,10)) conv_factor
SQL server taking a default scale, you need to explicitly specify the precision and scale.
regards
Hari
February 22, 2010 at 5:50 am
Use the below query
---------------------
DECLARE @cmdstr varchar(100)
SET @cmdstr = 'bcp "select sku,auction_type_id
from auctions
where status_id = 2" queryout "D:\ppc_auctions.txt" -t "," -c -T'
print @cmdstr
EXEC master..xp_cmdshell @CMDstr
December 11, 2009 at 4:09 am
Viewing 6 posts - 1 through 6 (of 6 total)