Forum Replies Created

Viewing 15 posts - 361 through 375 (of 683 total)

  • RE: sequencing the column with group by v2

    Here's a 'not recommended' way:

    --data

    create table #tableA (a int, b VARCHAR(3), c VARCHAR(4))

    insert #tableA

    select 1, 'DD', '5' union all 

    select 1, 'DS', '6' union all

    select...

    Ryan Randall

    Solutions are easy. Understanding the problem, now, that's the hard part.

  • RE: strip out NULL from recordset and merge

    My specialty

    Ryan Randall

    Solutions are easy. Understanding the problem, now, that's the hard part.

  • RE: strip out NULL from recordset and merge

    As a nasty hack, you can use the approach below, but you're much better off sorting out the problem at source (i.e. where you create that ugly result set).

    Ryan Randall

    Solutions are easy. Understanding the problem, now, that's the hard part.

  • RE: Create a text file from SQL data

    > Query Analyzer only outputs 256 characters

    Not necessarily. Try changing the setting in 'Tools -> Options -> Results -> Maximum characters per column'. Maximum setting is 8192.

    Maybe that will give you...

    Ryan Randall

    Solutions are easy. Understanding the problem, now, that's the hard part.

  • RE: problem using MAX on date

    >> Books Online states that SMALLDATETIME is only accurate to the minute.

    Yep. That's why they will often have the same value for callreceived. And why you can't then really tell which...

    Ryan Randall

    Solutions are easy. Understanding the problem, now, that's the hard part.

  • RE: problem using MAX on date

    How do you identify the "most recent" call if they have the same value for callreceived?

    Perhaps you would be better using datetime datatype, rather than smalldatetime?

    You can use "top 1" (as...

    Ryan Randall

    Solutions are easy. Understanding the problem, now, that's the hard part.

  • RE: how to insert date in the query result?

    Peso - Really?

    You can use OPENROWSET to add 2 rows to the top of an Excel sheet which already has data in it and add the date there? Really?

    (I hope you're...

    Ryan Randall

    Solutions are easy. Understanding the problem, now, that's the hard part.

  • RE: how to insert date in the query result?

    To do exactly this, I think you need to use OLE Automation. You can read about that in BOL, or here:

    http://www.databasejournal.com/features/mssql/article.php/1442201

    I think Excel will need to be installed on your...

    Ryan Randall

    Solutions are easy. Understanding the problem, now, that's the hard part.

  • RE: how to insert date in the query result?

    So the xls file already exists, and you want to add a couple of rows (rows 1 and 2, say) to it and put the date in row 1? And you...

    Ryan Randall

    Solutions are easy. Understanding the problem, now, that's the hard part.

  • RE: rotate a table

    This looks like a dynamic pivot table request, and I suggest you refer these articles:

    http://www.sqlteam.com/item.asp?ItemID=2955

    http://weblogs.sqlteam.com/jeffs/archive/2005/05/02/4842.aspx

    Ryan Randall

    Solutions are easy. Understanding the problem, now, that's the hard part.

  • RE: how to insert date in the query result?

    Amit - that returns "Jul  5 2" for me.

    fred - one of these will get the date in the format you need.

    select convert(varchar, getdate(), 101) as created...

    Ryan Randall

    Solutions are easy. Understanding the problem, now, that's the hard part.

  • RE: Running a script/proc in multiple DB''''s

    Or...

    create table #output (name sysname, sysname, access bit)

    exec sp_MSforeachdb @command1 =

      'insert #output select ''?'', name, hasdbaccess from ?.dbo.sysusers where name in (''guest'', ''public'')'

    select * from...

    Ryan Randall

    Solutions are easy. Understanding the problem, now, that's the hard part.

  • RE: help in open XML(how to overcome file size limitation)

    The other link I posted said: "Drop it in the too hard basket - I'm going to do it another way....". You might, therefore, both be out of luck!

    I recall...

    Ryan Randall

    Solutions are easy. Understanding the problem, now, that's the hard part.

  • RE: repeating rows for different years

    A simple tally table and a cross join will save you a while loop / repetitive coding / typing. Here's one quick implementation as an example...

    Ryan Randall

    Solutions are easy. Understanding the problem, now, that's the hard part.

  • RE: Updating rows in table from Select query

    Or maybe something like this?

    --data

    declare @t table (col1 varchar(1), col2 int, col3 int, col4 int, col5 int)

    insert @t (col1, col2)

              select 'A', 1

    union all select 'B',...

    Ryan Randall

    Solutions are easy. Understanding the problem, now, that's the hard part.

  • Viewing 15 posts - 361 through 375 (of 683 total)