Forum Replies Created

Viewing 15 posts - 316 through 330 (of 683 total)

  • RE: datepart Help

    For the same reason these aren't...

    select cast(24 - 7 - 2006 as datetime)

    select cast(-1989 as datetime)

    Maybe one of these is what you're after...

    select replace(convert(varchar(30),...

    Ryan Randall

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

  • RE: Disable DTS job from SQL?

    Have you tried sp_update_job? e.g.

    EXEC sp_update_job @job_name = 'My Job', @enabled = 0

    Ryan Randall

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

  • RE: using union all syntax with sum function

    Something like this?

    --data

    declare @t table (MAJOR int, MINOR char(4), PRODMGR char(2), CST_USD int, REV_USD int, LCTRYNUM int, AMT_TYPE char(1))

    insert @t

              select 538, '1616', 'LN', 0, 250,...

    Ryan Randall

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

  • RE: dynamic file location in T-SQL

    > Couldn't I do this without declaring a new table and just use the value from the already existing table?

    Yes. Exactly that. My "example data" was...

    Ryan Randall

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

  • RE: dynamic file location in T-SQL

    So you just want to set a variable with a value that's in a table? That simple? If so, here's an example...

    --example data

    declare @t table (id...

    Ryan Randall

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

  • RE: dynamic file location in T-SQL

    It's not clear to me what you're asking.

    If you are loading data from a file, but want that data to be slightly different in the table you're loading it to, then first...

    Ryan Randall

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

  • RE: Rounding float values

    You can cast it as a decimal...

    declare @x float

    set @x = 88.125

    select @x, cast(@x as decimal(8, 2))

    Ryan Randall

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

  • RE: COALESCE by UserID

    By the way, to fix Jules' code, we just need the datatype of usertext to be varchar rather than char in the table (or to add an rtrim to the...

    Ryan Randall

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

  • RE: COALESCE by UserID

    Jules - I have similar problems getting the code working. It's not important, however, since I am familiar with that method and I understand the idea.

    This article and subsequent comments mention...

    Ryan Randall

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

  • RE: How to convert rows of data into table stucture

    This looks like a pivot/crosstab request, and there are several articles out there on the subject.

    I recommend you take a look at them...

    http://www.sqlservercentral.com/columnists/plarsson/pivottableformicrosoftsqlserver.asp

    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: (n)th resultset of a procedure

    Well, with your example you can do this...

    CREATE PROCEDURE sp_test

    AS

    SELECT 55

    SELECT 'xx'

    GO

    CREATE TABLE #tblTest (v sql_variant)

    INSERT INTO #tblTest EXEC sp_test

    SELECT v, SQL_VARIANT_PROPERTY (v, 'BaseType') as 'BaseType'...

    Ryan Randall

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

  • RE: COALESCE by UserID

    Or...

    --data

    create table users (UserId tinyint, usertext varchar(50))

    insert users

              select 1, 'ABC'

    union all select 1, 'DEF'

    union all select 2, 'ABC'

    union all select 3, 'ABC'

    union all select 3,...

    Ryan Randall

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

  • RE: how can i write this query

    I've just written this, and then just read Dan's post. I've assumed messageid is an identity, but have not assumed records are entered in date order.

    I guess use the one...

    Ryan Randall

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

  • RE: 3 Arrays as the input parameters

    I agree with Ray, but for what it's worth...

    --preparation (adapted from http://www.mindsdoor.net/SQLTsql/ParseCSVString.html)

    create function fn_ParseCSVString (@CSVString varchar(8000), @Delimiter varchar(10))

    returns @tbl table (row int identity(1, 1), s...

    Ryan Randall

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

  • RE: I want to copy data from one table to ....

    I'm with Phil.

    If it's about comparing all the columns, you can do something along the lines of...

    --data

    declare @t table (a int, b int, c int)

    insert @t

             ...

    Ryan Randall

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

Viewing 15 posts - 316 through 330 (of 683 total)