Forum Replies Created

Viewing 15 posts - 16 through 30 (of 32 total)

  • RE: SQL help on selecting records based on content and their neighbors content

    Rob, your join is not considering the page number. you should probably include the page in the join.

    Michele, your final query pulls all the records of the matching page.. but...

  • RE: Query Question

    Slackr,

    You may create a word matching function as below and use the count of words matching to join the tables.

    alter function Matching_Words_Count(@s1 varchar(1000), @s2 varchar(1000))

    Returns int

    Begin

    Declare @word varchar(50)

    Declare @ctr...

  • RE: Counting a consecutive condition

    Here's a simpler one:

    select distinct e1.emp_id

    from #emp e1 INNER JOIN #emp e2

    on e1.emp_id = e2.emp_id and datediff(d,e1.date,e2.date) between 0 and 4

    Where e2.date>=e1.date

    group by e1.emp_id,e1.date

    having sum(Case e2.met When 1...

  • RE: update all fields in a table

    Am assuming that the column names will be the same in both the new and old tables. You can use the below query then:

    Declare @updateSQL varchar(1000)

    Set @updateSQL = 'Update Table1...

  • RE: Select an aggregate list?

    Hi, you cannot do it without the help of functions..

    My answer:

     

    create function return_friends (@id int )

    returns varchar(100)

    begin

     declare @f varchar(100)

     set @f=''

     select @f= @f+friend+',' from TableFriends where id=@id

     Return left(@f,len(@f)-1)

    end

    create...

  • RE: Challenge for SQL Gurus: Grouping and outer joins

    Hi guys,

    sorry for the late response. many of you have expressed concern on the cartesian join (CROS JOIN).. my only intension was to achive the desired result. CROSS JOIN is...

  • RE: Chinese Simplified font

    I use VB Script to load the data

  • RE: Chinese Simplified font

    yes i do..

    If I follow the steps below I can translate to chinese characters:

    >Open excel

    >Open the text file and when it prompts for encoding type to be applied for...

  • RE: Chinese Simplified font

    Hi friend, tried that but the funny characters are not getting changed.

  • RE: Challenge for SQL Gurus: Grouping and outer joins

    Hi guys,

    Try this one (simplified version):

    select x.group1,x.group2,x.xref,sum(d.value1), sum(d.value2) from

    (select distinct group1,group2,x.xref from @xref x,@data d) as X

    LEFT OUTER JOIN @data d

    on x.[group1] = d.[group1] and x.[group2]=d.group2 and...

  • RE: Assign value to variable of data type ''''Text''''

    Thanks friend.

    Since the user will just copy the data from Excel and paste in the text area, each line will be separated by chr(13) or chr(10) and so i replace...

  • RE: Assign value to variable of data type ''''Text''''

    thanks, but what am looking for is slightly different from the solutions you have given.

    background:

    my asp pg has a textarea, where in user will input a large amount of data...

  • RE: SQL Jobs

    Thanks, Just had a look

    -Hari

  • RE: Mutlipe row concatenation

    Hi,

    You can try this solution

    Declare @longStr varchar(5000)

    Set @longStr=''

    Select @longStr=@longStr + col1+'~'+col1+'~'+col2+'~'+...+colN+'$'

    From Orders

    But this string may get truncated if your rowsize increases.

    -Hari

     

     

     

  • RE: table name and column name

    Hi Sam,

    You can achieve the same by using the below query:

    DECLARE @col_list varchar(1000)

    Select @col_list = ''

    Select  @col_list =@col_list+ ([TABLE_NAME]+'.'+[COLUMN_NAME])+',' from INFORMATION_SCHEMA.COLUMNS

    where table_name IN ('Table1','Table2')

    Select @col_list = LEFT(@COL_LIST,LEN(@COL_LIST)-1)

    print @col_list

    Select @col_list...

Viewing 15 posts - 16 through 30 (of 32 total)