I am new to SQL server. I am trying to create a scalar-valued function which will act like charindex. but I am not so sure why when I call the function like it return 0 as result. Thank you so much for your help 🙂 have a great day guys Answer In SQL Server, you need to specify lengths on
Tag: sql-server
Select Query is not working with WHERE clause when there is a space in column value
Select Query is not working with WHERE clause when there is a space in column value. since my table column value has space in it. When I copied same value from query result and put that with where clause, it doesn’t return any result. . if I run below query , it doesn’t return any result SQL Serve…
How to make a start on this SQL query homework? [closed]
Closed. This question needs debugging details. It is not currently accepting answers. Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question. Closed 2 years ago. Improve this question A mov…
How to sum transaction amounts for different time intervals in sql server?
Let say I have table called Transactions and have 3 following columns: Customerid TranscationDate TransactionAmount So I need to sum transaction amounts for each customer in different date intervals. …
How do a pivot on sql server on one column but renamed dynamics column
I’ve a table of prices With Reference, Price Category (Ex professional/Customer…) , the weight and the price Each article have X lines for same Reference, Price Category depend of weight I Want a return with Reference, Price Category, Price1,Price2… I try to adapt codes I’ve found but …
Max and Avg debt days over a period of time
I have invoices pending payment, every invoice has two dates, first when the invoice is required to pay and the other when the invoice is paid. I want to know in a period of time the max debt and the …
Grouping shift data by 7-day windows in SQL Server 2012
What I want to do is to calculate the number of shifts and hours worked by each employee in any given 7-day period. In order to achieve this, I need to identify and group ‘islands’ of shifts. Note …
Assign new value to every unique number in SQL Server
I am new to SQL Server and trying to do some operations Sample data: Amount | BillID ——-+——- 500 | 10009 500 | 1492 350 | 15892 222 | 15596 899 | 20566 350 | 9566 How can …
Compare SQL scalar function result to a column in SQL
I have this query Here I need to compare the result of function i.e dbo.GetTopEmployerName() with x4.code. I need to check if they are not same. Answer Wrap your query up in a derived table:
Specific hierarchy geography
I have a table geography with three levels I need to display the level3 only for level2 = France, Benelux and for the other countries level2 = level 3 Result Example: Answer