Forum Replies Created

Viewing 15 posts - 1 through 15 (of 21 total)

  • RE: Help with Group By

    declare @t table (ID int, Cost int, ItemNumber nvarchar(2))

    insert into @t

    select 1, 50, 'A' union all

    select 1, 40, 'A' union all

    select 1, 50, 'B' union all

    select 2, 30, 'D' union...

  • RE: How to Convert Varchar to datetime datatype

    declare @test-2 varchar(20)

    set @test-2 = '09-06-2005 00:00:00'

    select datediff(month, cast(@test as datetime),getdate())

    select cast(@test as datetime)

  • RE: Add blank spaces in field

    The only thing I can think of is using a trigger to update that field after insert

    update query:

    --drop table #t

    create table #t (spaces nvarchar(9))

    insert into #t

    select 'me' union all

    select 'you'...

  • RE: calculate the sum of last 12 months

    I don't think this is pretty but it works

    declare @date datetime

    declare @prodid nvarchar(20)

    declare @m nvarchar(2)

    declare @y nvarchar(4)

    set @prodid = 'prod1'

    set @y = 2009

    set @m = 3

    set...

  • RE: Need to Add year using Dateadd function

    r_prasanna82 (9/15/2009)


    The format from the source is mm/dd/yyyy time.

    YYYY-MM-DD

    (DB_DATE)(SUBSTRING(columnname, 7,4) + '-' + SUBSTRING(columnname, 1,2) + '-' + SUBSTRING(columnname, 4,2) )

  • RE: Distinct area code / phone #

    Example for Row_Number Function

    declare @t table (name nvarchar(10), tn nvarchar(10), date datetime)

    insert into @t

    select 'matt','1234567890','2009-09-15' union all

    select 'john','2345678901','2009-05-15' union all

    select 'pete','','' union all

    select 'matt', '2345678901','2009-04-18' union all

    select 'john','7890123456','2009-09-15'

    select name, tn...

  • RE: loop through folder and delete txt files

    My understanding is that your user variable "Path" is being filled with a value like: "\\serverA\folder1\folder2"

    and your user variable "Path" is the variable being used in the second foreach loop...

  • RE: loop through folder and delete txt files

    I left the folder field in the enumerator configuration of For Each loop container empy.

    It is okay for this to be empty, by setting the directory property with the variable...

  • RE: loop through folder and delete txt files

    I left the folder field in the enumerator configuration of For Each loop container empy.

    It is okay for this to be empty, by setting the directory property with the variable...

  • RE: loop through folder and delete txt files

    Everything that I gave you is based off of your first foreach loop,

    put in a breakpoint and see if the mapped variable in the first loop is being filled

  • RE: loop through folder and delete txt files

    right click on the filesystems task and set the property "delay validation" = true

  • RE: loop through folder and delete txt files

    If you want to delete every text file in the folder you can:

    Insert another foreach loop container inside of the one you have now

    Set your "Enumerator" = Foreach File Enumerator

    Open...

  • RE: how to cut the data with based on comma

    I fixed my previous query:

    drop table #t1

    go

    create table #t1

    (

    RowId integer,

    SomeName nvarchar(6),

    ValueStr nvarchar(50)

    )

    go

    insert into #t1 values(1,'giri','1,2,3')

    insert into #t1 values(2,'nani','1,2')

    drop table #t2

    go

    create table #t2

    (ID int,

    Alpha varchar(1))

    go

    insert into #t2 values(1,'a')

    insert into #t2 values(2,'b')

    insert...

  • RE: how to cut the data with based on comma

    This worked out well:

    drop table #t1

    go

    create table #t1

    (

    RowId integer,

    ValueStr nvarchar(50)

    )

    go

    insert into #t1 values(1,'1,2,3')

    insert into #t1 values(2,'2')

    insert into #t1 values(3,'2,3')

    insert into #t1 values(4,'2')

    drop table #t2

    go

    create table #t2

    (ID int,

    Alpha varchar(1))

    go

    insert into...

  • RE: How To Replace Part Of A Text Column

    Or,

    If you are not sure where you need the space you could search for ',%'

    DECLARE @SQLTEXT Table(SQLText ntext)

    INSERT INTO @SQLTEXT Values('usp_CheckWeeklyResponseTeam %BD%, %ED%, %S%, %F%,%D%, %V%')

    Select SQLTEXT , REPLACE(CONVERT(varchar(max),SQLTEXT),',%',',...

Viewing 15 posts - 1 through 15 (of 21 total)