(Edit: I am bound to use Visual Studio 19 and have no rights to install any other application) I have a small SQL table with about 150k rows and 20 columns which I need to modify. I need the table to be ordered by date. I need the first occurrence of a value from two columns. Depending on if the
Tag: sql
Filter msdb.dbo.sysjobsteps.command into seperate columns
I am trying to split the msdb.dbo.sysjobsteps.command column into separate columns to show the following information: folder project dtx package A small sample of my data is below: I have tried to use the substring method, however I cannot seem to get the starting and ending number of the substring. My aim is…
Way to alter one table if another was altered
For example, I am having table T1 and archive table T1_A Create table T1(n number); Create table T1_A(archieve_dt date,n number); To make activation working correctly if I am adding a column to T1 …
getting error in Sql Query incorrect syntax near ‘)’ [closed]
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers. This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers. Closed las…
MySQL – ORDER BY multiple words, then alphabetically?
How can I change this part of the query to have multiple words ordered first in sequence, then the rest of the results alphabetically? ORDER BY CASE WHEN name LIKE ‘%Professional%’ THEN 0 ELSE 1 …
SQL `SELECT ‘some string value’ AS fieldname` equivalent in Powershell?
In SQL I can go SELECT actualField, “repeat” AS bs_repeated_value FROM Table1 And I can repeat the bs_repeated_value field as many times as there are rows no matter what I name the field! Now in a …
Using replace() inside a loop
I am trying to copy indexes from materialized views onto tables. This is the script I am trying to use: DO $$ declare indexdefname record; a text; b text; c text; begin for indexdefname in …
Update column – remove first and last characters
I have written a successful SELECT statement to both show me all the company names that are surrounded by double quotes like “ABC Company” for example. I want to permanently remove the double quotes …
T-SQL – Adding FK to table, make it do drop/null/efault automagically?
If I had two tables where I need to add a new foreign key to, say: ALTER TABLE [release_user] ADD CONSTRAINT [user_release] FOREIGN KEY ([user_id]) REFERENCES [user_table] ([user_id]) …
SQL perform AVG after MAX
I have two tables. Table1: | ID1 | ID2 | ID3 | ID4 | |—–+—–+—–+—–| | 200 | 125 | 300 | 201 | | 206 | 128 | 650 | 261 | | 230 | 543 | 989 | 403 | and Table2: | ID1 | ID2 | ID3 | ID4 | …