like isnull?

Is there any way to check if like?

select @myVariable isequal("hotta","kutel")

If it is equal to "hotta" set it as "kutel"


something like this?

Dani AI

Generated

For Sybase (as asked and after asked which RDBMS), use the equality operator and either an IF block for flow-control or a CASE expression for inline assignment. String literals must use single quotes in T-SQL (double quotes are for identifiers when enabled), so comparisons like "hotta" should be 'hotta'.

Example: IF-based assignment

if @myVariable = 'hotta'
begin
    select @myVariable = 'kutel'
end

Example: single-statement using CASE

select @myVariable =
    case when @myVariable = 'hotta' then 'kutel' else @myVariable end

Notes and troubleshooting:

  • Comparisons with NULL are not true; use is null to test for NULL or wrap with a null-replacement function (for example isnull(...,'') or coalesce(...)) if the intent is to treat NULL as an empty value.
  • Collation/case-sensitivity matters: a case-sensitive database will treat Hotta and hotta as different; normalize with upper()/lower() if needed.
  • SET and SELECT both assign variables. SET is ANSI-standard for single assignments; SELECT can assign from queries — be careful if the query returns multiple rows.
    These patterns cover the typical "if equal, change value" use case in Sybase.

Recommended Answers

All 2 Replies

What rdbms are you using?

sybase...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.