Skip to content
Advertisement

Tag: sql-server-2012

Case statements with Join on lookup

I have a big table with some columns having lookup values. I want to create a description column for each lookup column and populate them with description from lookup table. Here is one example main table id1 id2 id3 1 2 3 1 3 4 look up table code id desc id1 1 id1-desc1 id2 2 id2-desc2 id2 3 id2-desc3

Get DateTime from text

How to separate and display only the DateTime from the string? I have a column that holds this data: I used this query to separate out the time: and it returned the same lines. String didn’t get filtered When I tried using this statement: I got this error Conversion failed when converting date and/or time from character string. How can

Get best hit first

I have a table department with a columns SearchKeysName and BOLD_ID. Bold_ID is just a number for identification of row. It contains data like this: To search data I have SQL like this: In this case I searched for 32-1 so it will pick the rows above. What I want is to make sure the exact hit is placed on

How can I delete record based on date?

I have a set of data with DateTime type in SQL. I want to delete whatever data belong to a specific date for ex: 2021-11-02 21:07:52.663. if I have value like above I want to delete records using just date. 2021-11-02. Answer This will compare the date part of your datetime to the desired date:

SQL query subtable in columns from main query

I have 2 tables with a main table with a unique UUID as index and a sub-table containing the languages of 1 row of the main table. E.g. table_1 uuid code 111-etc 123 222-etc 321 table_1_lang uuid lang_code title 111-etc en english 123 111-etc de deutch 123 222-etc en english 321 222-etc de deutch 321 I want to create a

sql query to exclude not null columns

I have below table and records Now i do not want to display the rows having null values in the columns except primary key column. I used below query to arrive the above result. But my orginal table having 72 columns how can i check all the columns for getting above result. / Answer You could check the length of

Advertisement