I am creating a General Ledger report for the finance team. I have a list of all transactions by calendar Month. Of course some GL codes are not used every month for whatever reason. I do have another …
Tag: sql-server
Return multiple tables specific to each column
I would like to get a more simple query that runs through all columns of a table and returns the SAME number of tables for EACH column. For example… select distinct a from tbl; select distinct b …
SQL: Sort rows based on attribute order
I want to sort an the value of an attribute (called position) to the row number of another attribute’s ordering. Example: If I have the following attributes: position, points I’d like to order the …
SQL Server case based off of another column
How could I go about using a case statement to set column final, based on column S? The objective is to use any record that has a final, and also include any records from column S only if S = ‘…
SQL Hasmany Query select 1
I have two tables which I am trying to query. Stock_Table Stock_Code Stock_Name Physical_Stock Order_Table Order_Date Quantity Stock_Code I’m after all stock records where the physical stock …
“Incorrect syntax near ‘)’.”
I have a program that is to take a couple inputs and do stuff to them then store them in a local database (using SQL Server). I have the following code for the connection: SqlConnection con = new …
Keep ORDER BY clause is invalid in view
I have the following SQL Statement: Select CountryCodeTwoChar FROM (Select CountryCodeTwoChar From [Country] Order By CountryName ) TBL Where CountryCodeTwoChar = N’PS’ But I have the following …
SQL query that worked before, does not work anymore
An excel file i’m being supplied daily contains a space in one of the numbers that is supposed to be an integer. This was easily fixed when i simply replaced it via a replace and convert in a query. …
Create parent/child relation in SQL server based on the below scenario
In this picture, 2018_9UKDT – UKD Expense Total is parent of 2018_9Q400 – UKD Indirects and this in turn is parent to 98064 – IT SDS Costs, 98063 – ACS in charges, 98012 – UKD …
How do I get a value from XML column in SQL?
So, I have a table with a large chunk of data stored in XML. The partial XML schema (down to where I need) looks like this: …