Viewing 15 posts - 2,056 through 2,070 (of 2,452 total)
doesn't Mark's code above provide your solution?
January 27, 2012 at 4:58 am
any chance that you might provide some set up script and sample data pls...we can then easily cut and paste into SSMS to give you a tried and tested answer.
please...
January 27, 2012 at 3:40 am
does this work...
would be interested to learn about the requirement for this....have you over simplified the process?
--- Look up "Tally Table.....http://www.sqlservercentral.com/articles/T-SQL/62867/ by Jeff Moden
SELECT ID AS RecordID,
...
January 25, 2012 at 1:51 pm
a slightly different take on this.....
expanded the DDL that Sean provided
USE [tempdb]
GO
IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Forum]') AND type in (N'U'))
DROP TABLE [dbo].[Forum]
GO
IF EXISTS...
January 23, 2012 at 12:47 pm
pwalter83 (1/23/2012)
J Livingston SQL (1/23/2012)
Click "Create" on the top menu bar/ribbon....select "Table"
Thanks for your reply, however, I do not want to create a new table from scratch. I only wish...
January 23, 2012 at 8:26 am
Click "Create" on the top menu bar/ribbon....select "Table"
January 23, 2012 at 8:16 am
the answer is already in the quote you used
"joining such many tables may degrade the performance"
...it all depends.
Do all the tables have indexes that are well maintained and cover...
January 21, 2012 at 7:43 am
another idea.....
DECLARE @t TABLE (companyname VARCHAR(10), amount int)
INSERT @t
VALUES ('xxx', 10),
('yyy', 8),
('zzz', 9),
('unknown', 3)
select 100- CAST (amount/((select SUM(amount) from @t)/100.0) as decimal (5,2)) as AllocatedCharge_percentageoftotal
from @t
where companyname =...
January 20, 2012 at 1:34 pm
danny09 (1/20/2012)
I am not sure what the formula would be to calculate the percentage and that's the reason i am posting it here for your help
I am not looking for...
January 20, 2012 at 12:40 pm
Hi
based on the example data you originally provided...can you please tell us what your expected results are??....hopefully this will clarify for all of us.
regards
January 20, 2012 at 12:08 pm
think you have been around here long enough to know that some table scripts / data and expected results will assist all of us 🙂
January 20, 2012 at 11:08 am
mick burden (1/20/2012)
January 20, 2012 at 9:07 am
can you please explain the business reason why cannot you store your data as below
this will treat you better long term, rather than someone conjuring up some dynamic code for...
January 20, 2012 at 8:56 am
think this works...its horrible....and your data doesnt match your expected results (Jim)
the question is why are you storing your data this way (excel as source ???)
WITH CTE
...
January 20, 2012 at 8:32 am
Viewing 15 posts - 2,056 through 2,070 (of 2,452 total)