Forum Replies Created

Viewing 15 posts - 2,131 through 2,145 (of 2,169 total)

  • RE: import csv file by calling store proc

    Or you could utilize the OPENROWSET function. Example for XLS file below. Read in BOL about CSV file.

    SELECT * FROM OPENROWSET('Microsoft.Jet.OLEDB.4.0',

    'Excel 5.0;HDR=No;IMEX=0;Database=\\someserver\somepath\somefile.xls', 'select * from [Sheet1$b35:q50]')

    where f1 in (''a',...

  • RE: Calculate Ranking on Records.

    How would you like ties to be ranked?

  • RE: Count of trouble_codes per store_id

    Maybe like this?

     

    CREATE PROCEDURE dbo.sp_trouble_codes

    AS

    select table1.store_id,

    count(table2.trouble_code)as 'Total',

    sum(case when table2.trouble_code='101258' then 1 else 0 end) 'code_theft',

    sum(case when table2.trouble_code='101259' then 1 else 0 end)'code_fire'

    sum(case when table2.trouble_code='102103' then 1 else 0 end)...

  • RE: Grouping Issue

    I don't think I can make this simpler...

    -- Populate test data

    declare @t table (row int, path varchar(50))

    insert @t

    select 92, 'ww.test.com/a' union all

    select 91, 'ww.test.com/b' union all

    select 87, 'ww.another.com/a' union...

  • RE: Script to Sync Permissions

    Most probably you have done a restore. The user is there but not mapped to the current database.

    In Users for current database, delete the user in mind. In Security, delete...

  • RE: set my header

    Hrmm...

    SELECT GETDATE() AS 'This is current date and time'

    SELECT GETDATE() AS [This is current date and time]

    In QA, select Query menu and then any of "Results in Text", "Results in...

  • RE: Multi-Value parameters

    Search the forum for a "list split" function. Preferably a function that returns a resultset with all parameters numbered.

     

  • RE: Calculate Ranking on Records.

    declare @t table (prog varchar(8), cost int)

    insert @t

    select 'Prog-A', 15000 union all

    select 'Prog-B' ,16000 union all

    select 'Prog-C', 21000 union all

    select 'Prog-D', 17000

    select prog 'Program Name',

     cost 'Cost',

     convert(varchar, (select count(*) from @t...

  • RE: Returning number of days in month by year

    I am not sure what you want.

    DECLARE @Year SMALLINT

    SELECT @Year = 2006

    SELECT 1 'Month', 31 'Days' UNION

    SELECT 2, CASE WHEN ISDATE(CONVERT(CHAR(4), @Year) +...

  • RE: Query with multiple And statements

    You can make a tremendous improvement for this query! As it is right now, you are selecting the cartesian product (all possible combinations) for the 18 tables you have. That would...

  • RE: Problem with Sequence Number

    I just couldn't let this one slip away

    Perhaps Ryan can take a look at this approach, even it is not completely setbased. it's...

  • RE: Having trouble splitting a list to a resultset?

    Thank you.

    There are some ways to further optimize this solution. If you know you never will have more than 256 "params", and every param has maxlength of 50, shorten the...

  • RE: Problem with Sequence Number

    You can have your cake and eat it too. Here is a solution that does not need a function for sorting your strings. I don't know if there...

  • RE: UpdateText() not working correctly

    UPDATE     TestTbl

    SET           Task = REPLACE(Task, '&', '&')

     

    That should do the trick.

  • RE: Any ideas why this query is running so slow?

    And the WHERE clause could be somewhat easier to optimize with

     

    SELECT DISTINCT dbo.cs_ArticleTracking.id,

      dbo.cs_ArticleTracking.taskProblem,

      dbo.cs_ArticleTracking.dateCreated,

      cs_users-firstname + ' ' + cs_users.lastname AS fullname

    FROM  dbo.cs_ArticleCategories

    INNER JOIN dbo.cs_ArticleTracking ON dbo.cs_ArticleCategories.parent = dbo.cs_ArticleTracking.parentcategory AND dbo.cs_ArticleCategories.child = dbo.cs_ArticleTracking.childcategory AND...

Viewing 15 posts - 2,131 through 2,145 (of 2,169 total)