Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8343365
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T06:02:20+00:00 2026-06-09T06:02:20+00:00

I am trying to convert the following query from SQL server based code to

  • 0

I am trying to convert the following query from SQL server based code to TERADATA code.

INSERT INTO #Keyword(Keyword,OmnitureHitsID,Hit_Time_GMT)    
            SELECT  Search, @PrvRowIdentity,Hit_Time_GMT     
            FROM    
            (SELECT     
                Evar02_Search     
            , Hit_Time_GMT     
            , Evar11_End_Keyword     
            , Evar14_End_SrchTrmPassed     
            , Post_Evar02     
            , Post_Evar11     
            , Post_Evar14     
            FROM #MaINTable WHERE ID = @i    
            AND Visid_High =@Visid_High ) p    
            UNPIVOT     
            (SEARCH FOR SearchKeyword IN     
                (Evar02_Search     
                , Evar11_End_Keyword     
                , Evar14_End_SrchTrmPassed     
                , Post_Evar02     
                , Post_Evar11     
                , Post_Evar14 )    
            ) AS unpvt;

Can anyone tell me how to convert the part after UNPIVOT. Actually I am not sure what the SEARCH FOR SearchKeyword IN part does.

Any help is appreciated 🙂

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T06:02:22+00:00Added an answer on June 9, 2026 at 6:02 am

    Unfortunately, Teradata does not have an UNPIVOT function but you can replicate it using a UNION ALL query:

    INSERT INTO #Keyword(Keyword,OmnitureHitsID,Hit_Time_GMT)    
    SELECT  Search, @PrvRowIdentity, Hit_Time_GMT     
    FROM    
    (
      SELECT Hit_Time_GMT, Evar02_Search as Search, 'Evar02_Search' as col
      FROM #MaINTable 
      WHERE ID = @i    
        AND Visid_High =@Visid_High 
      UNION ALL
      SELECT Hit_Time_GMT, Evar11_End_Keyword as Search, 'Evar11_End_Keyword' as col       
      FROM #MaINTable 
      WHERE ID = @i    
        AND Visid_High =@Visid_High 
      UNION ALL
      SELECT Hit_Time_GMT, Evar14_End_SrchTrmPassed as Search, 'Evar14_End_SrchTrmPassed' as col       
      FROM #MaINTable 
      WHERE ID = @i    
        AND Visid_High =@Visid_High 
      UNION ALL
      SELECT Hit_Time_GMT, Post_Evar02 as Search, 'Post_Evar02' as col     
      FROM #MaINTable 
      WHERE ID = @i    
        AND Visid_High =@Visid_High 
      UNION ALL
      SELECT Hit_Time_GMT, Post_Evar11 as Search, 'Post_Evar11' as col     
      FROM #MaINTable 
      WHERE ID = @i    
        AND Visid_High =@Visid_High 
      UNION ALL
      SELECT Hit_Time_GMT, Post_Evar14 as Search, 'Post_Evar14' as col     
      FROM #MaINTable 
      WHERE ID = @i    
        AND Visid_High =@Visid_High 
    ) x
    

    The Search part of your current UNPIVOT query is getting the value for the columns in each of the SearchKeyword columns listed. So this can be replicated by using a UNION ALL that gets the following for each column:

    • Hit_Time_GMT for each field
    • Search value for each of the columns (Evar02_Search, Post_Evar02, etc)
    • the last field in the UNION ALL just specifies which column the value came from
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to convert the following SQL into NHibernate: SELECT * FROM dbo.Customer
I am trying to convert the following code from Trefethen's Spectral Methods in MATLAB
I am trying to convert the following SQL into a LINQ expression SELECT COUNT(ID)
I am trying to convert following SQL query to linq; select Or.Amount, Usr.Name, Usr.Email
I'm trying to convert the following SQL query to an ICriteria in NHibernate. SELECT
Have the following (non-straightforward) T-SQL query, which i'm trying to convert to LINQ (to
I am trying to convert following table data into nested array using PHP. I
I'm trying to convert the following list into a select list so it can
I'm trying to call a parameterized stored procedure from SQL Server 2005 in my
I am trying to write a query to insert a value into a timestamp

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.