I am in the process of creating an audit plan using ERD, going off the below image you can see that there’s a permissions table with four FK columns referring to the other four tables PK column. I am just confused as to how the IDs will relate to the other tables and how will it show up correctly in
Tag: sql-server
How to find which field is giving data type error in QUERY
I have the query report for user but have some error message display: Error converting data type nvarchar to bigint only one message. How to find which field is giving data type error in query? Anyone can give advice? Many thanks! Answer As you have not provided data, it looks like you have NVARCHAR datatype,…
How to get custom separators in SQL Server query
I have a table in SQL Server that looks like this If this table was in Oracle and I wanted to get all the properties separated by different separators then I would write something like this I would get output like this Notice all the separators are different. How can I write a similar select statement for SQL…
Creating a SQL Loop to Change the Table Name
I am needing to change the ending number of the table name in a loop to go from 1 through 12. This is a more straight forward example of my actual problem, but if this can be solved, then I can duplicate the results later on (Actual problem is using the past 12 months on a rolling basis for a
Trimming the beginning and end of string in SQL
I have quite a long string that I want to trim the beginning and ending of. See a random example below: { “topic”: “birds”, “body”:”cool bird”, “attachment1″:”bird1”, “attachment2″:”anotherbird” } My desired output…
MS SQL handling null values same as strange string
I have a view V_BaseData_Extract in MS SQL server with one column Comments having null values as well having other textual values too. Column type is nvarcahr. What’s happening is that SQL returning …
Multiple SUM’s in a SELECT but on one view
I’ve written a select statement to assist with timesheet approval. It show’s the summation of hours entered against a user based on different roles booked, i.e. Standard Office Hours, Overtime, Holiday & Offshore. I want a single row per [Name] but I get a row for every SUM where the user has …
Is using OPENXML() the best way to transform data in an XML Column to Rows and Columns?
I have a SQL Server table with a column of type XML. The XML data represents multiple allowable selections for a given field. An example of the XML data is as follows. I am using the following code to extract the data from the XML column and transforming it into rows that can be inserted into a new table. Thi…
SQL Server check for prior record only
I have these columns: type(char), date , price. I would like to check if the same type’s price has not changed in the previous record. I tried this for start: I only want to check for the date prior not for every date that is smaller. This table stores price changes. product_type change_date price ̵…
query range on column [closed]
Closed. This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed 1 year ago. Improve this question I need help on query where I can do the range query based on Name Column from names. e.g., as…