Forum Replies Created

Viewing 15 posts - 1,441 through 1,455 (of 3,221 total)

  • RE: Northwind Querry INNER JOIN GROUP BY

    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...

  • RE: Northwind Querry INNER JOIN GROUP BY

    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' ...

  • RE: Trouble when count by week in SQL

    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...

  • RE: how to remove duplicates irecords in a table

    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...

  • RE: Is there a way in T-SQL to obtain the day of the month in a XXst, XXnd, XXrd, XXth notation?

    diamondgm (2/12/2011)


    Yeah, there doesnt seem to be a built-in way to produce ordinals.

    I haven't run you function, but the logic didnt check out in my head; I may be wrong...

  • RE: Evaluating Spaces

    Here is a bit a kludge,

    Declare @Header VarChar(500)

    Set @Header = ' ' --this is 2 spaces

    IF (REPLACE( @Header,' ', '|') = '||') --replaces each space witha...

  • RE: How move new column a new location?

    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...

  • RE: How to change date from daywise to monthwise

    Have you attempted to use the DATEPART function?

    DATEPART ( datepart , date )

    Where datepart is mm as

    DATEPART ( mm , date )

  • RE: OldSQL

    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...

  • RE: Identify rows containing non-English characters within a unicode nvarchar.

    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...

  • RE: Insert fail Data Type Error Fix??

    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...

  • RE: SSIS 2008 - Remove characters from a text file

    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...

  • RE: I want calculate the percentage through an update of a table

    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 =...

  • RE: Deprecation consternation

    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...

  • RE: Extract 3 months worth of data

    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...

Viewing 15 posts - 1,441 through 1,455 (of 3,221 total)