Viewing 15 posts - 1,441 through 1,455 (of 3,221 total)
BE CAREFUL the T-SQL I posted will return 678 rows BUT that is all the rows and what you desire is ONLY those companies with the number of orders above...
February 13, 2011 at 4:22 pm
Had to use Northwind in my SQL 2008 but is this what you are looking for:
select c.companyname, COUNT(od.orderid) AS 'Number of orders' ...
February 13, 2011 at 4:05 pm
This will do the necessary summation and some output formatting.
SELECT 'W'+ CAST(DATEPART(wk,[Date]) AS VARCHAR(2))+ '-'
+ CAST(DATEPART(yy,[Date]) AS VARCHAR(4)),SUM(Amount) AS Amount
FROM #Money GROUP BY DATEPART(wk,[Date]),DATEPART(yy,[Date])
ORDER BY DATEPART(yy,[Date]),DATEPART(wk,[Date])
Typical...
February 13, 2011 at 7:40 am
ramana.palakolanu
i inserted values in 5 times
values(1001,'Suresh','President',NULL,'01/01/78',5000,NULL,10)
Insert into Emp values(1002,'Ramesh','Manafer',1001,'01/01/78',4000,NULL,20)
Insert into Emp values(1003,'Ravi','Manager',1001,'01/01/78',3500,NULL,30)
Insert into Emp values(1004,'Vijay','Manager',1001,'01/01/78',4000,NULL,40)
Insert into Emp values(1005,'Ajay','Salesman',1003,'02/04/79',3000,NULL,50)
If you did insert as you stated - "5 times" how...
February 12, 2011 at 1:44 pm
diamondgm (2/12/2011)
I haven't run you function, but the logic didnt check out in my head; I may be wrong...
February 12, 2011 at 12:57 pm
Here is a bit a kludge,
Declare @Header VarChar(500)
Set @Header = ' ' --this is 2 spaces
IF (REPLACE( @Header,' ', '|') = '||') --replaces each space witha...
February 11, 2011 at 3:08 pm
First of all why do you want to move the column [City] next to the column [state]?
The order in which you select items is the order in which...
February 11, 2011 at 1:42 pm
Have you attempted to use the DATEPART function?
DATEPART ( datepart , date )
Where datepart is mm as
DATEPART ( mm , date )
February 11, 2011 at 10:40 am
To point out there are significant additional expenses when moving to newer software. Think of the cost in man hours when upgrading SQL Server - replacing all those depreciated...
February 10, 2011 at 9:27 am
Here is a general way to detect a character whose value is greater than the "Englishl" character set. Note the code is more extensive than it should be for...
February 10, 2011 at 8:59 am
In order for those who want to help you with a tested solution can you post the table definition, some sample data and what error Messages are displayed. Following...
February 9, 2011 at 7:35 pm
Some ideas on what can be done:
DECLARE @test-2 VARCHAR(120)
DECLARE @Ans VARCHAR(120)
SET @test-2 = '2SURG"????"0"? ???"4"????"2"????"Take"????? ?????????????"200478"???"FLOORSTOCK]'
SET @Ans = (REPLACE (@Test ,'?' , ''))
--CHAR(34) on my code page is...
February 9, 2011 at 4:35 pm
To elaborate on Mike01 - example
Run these 2 snippets of T-SQL and notice what happens
DECLARE @N DECIMAL(5,2)
DECLARE @sumofvissits INT
DECLARE @Xpercentrecon INT
SET @N = 0.
SET @sumofvissits =27
SET @Xpercentrecon =2
SET @N =...
February 9, 2011 at 1:57 pm
If you are currently using SQL 2008 .... there is a method to detect items that will be depreciated. Use:
SELECT * FROM sys.dm_os_performance_counters WHERE object_name LIKE ('%deprecated%')
Further read...
February 9, 2011 at 1:07 pm
simflex-897410
1. To do what you need, you must be able to edit the DTS package. This editing of the existing package can not be performed in SQL 2005...
February 9, 2011 at 12:40 pm
Viewing 15 posts - 1,441 through 1,455 (of 3,221 total)