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
Tag: sql-server-2012
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
Decreasing Cumulative Sum That When Equal to or Less Than Zero Change Another Value
Below we have two tables, one of purchase orders and the other of sales orders. What I’m trying to do is assign each sales order to a purchase order, with free stock. Which I can do with the following query: Table 1 – Incoming Purchase Orders: number item shipDate qty usedQty freeQty 12 Toy 2021-11-20 100 95 5 22 Toy
Select only those columns from a table header which are present in data dictionary ColumnName
Prerequisite : all the tables are dynamic so i cant use the column names I have two tables Candidate table : Table which has all columns and data required to be selected DataDictionary : Table where i have only those columns which are to be selected for querying Now what i want to do is select only that data and
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 lists belonging to main table as columns on main table
I have a follow-up question based on the question asked in this topic: SQL query subtable in columns from main query I’ve managed to get the following table with the query answered in the topic above: uuid code title-en title-de 111-etc 123 english 123 deutch 123 222-etc 321 english 321 deutch 321 Next to the result I already have I
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
How to create table/view with data from another SQL server?
I have a database managed by a third party vendor and have access to read-only for the tables and views. I would like to be able to create a table from this database in a remote server. Is this possible? If so, how do I do it? Thanks in advance. Hey this is what I got from SELECT @@VERSION Microsoft