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 for the following in a ssms table:
Tag: sql-server
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]) …
Update a Table Variable Where Not Exists
UPDATE @Customer SET ValidaitonAction = 1 WHERE NOT EXISTS (SELECT 1 FROM DMScustomerupload WHERE AccountNumber = @Customer.AccountNumber) Where @Customer is a TABLE variable: DECLARE @…
SQL Server CASE Statement Evaluate Expression Once
I may be missing something obvious! Thanks in advance for any help. I am trying to use a CASE statement in an inline SQL Statement. I only want to evaluate the expression once, so I am looking to put …
DbContext.DbSet.FromSql() not accepting parameters
I have a database with two tables, and wrote a relatively simple select statement that combines the data and returns me the fields I want. In my SQL developer software it executes just fine. Now to …
How to make a comparison for the record that has rows to another rows? [closed]
I have first table that has columns: 1. id 2. key 3. value And second table(more like the list): key I need to get distinct id that contains all keys from second table I have tried …
Cannot resolve the collation conflict between this and that
I have data from 2 different databases, which i need to consolidate and compare which each other. An example: select distinct CustomerNo from DB1.dbo.TableCustomers UNION ALL select distinct CustNo …
How to merge rows based on date/time
Microsoft SQL Server Management Studio 14.0.17224.0 I have a dataset where users perform tasks for clients. Sometimes tasks can be done at the same time and sometimes not. I need to merge records …
Query that returns date of first and last record for each day within a d
I have a table that records vehicle locations and I wish to query this to get the first and the last record for each vehicle for each day in a date range. The table looks like: Registration Latitude …