Skip to content
Advertisement

Tag: sql-server

Get last and first record using rank()

I need to get first and last record (ordered by Date column) from table for certain SSID. It is not a problem if there is more records with same max or min date. All I need is union all. I am getting last record having max(date) with: How to I get first record (min(Date)) as well (same thing only with

How to import values from csv to SqlServer using c#

I have come across this problem.I am trying to import data into a database from a csv file.Normally the insert part works,but now I keep getting an error: Arithmetic overflow error converting int to data type numeric . The statement has been terminated.It is probably because I have id as the first property,but if I “shift” the array by omitting

TSQL – Fill in missing values as 0 for dates without a value

Apologies in advance for the pictures. I did these up as tables in Stack and they displayed fine in Preview but would not display properly once published. I have a sample dataset like below with many more KPIs. Picture Of Tables The dataset currently returned is just a join of these 2 tables and returns date instead of Date ID,

Select range in SQL

I have a sql database that have InvoiceNumber column Now i need to select range between two numbers, but i don’t know what happened. I’ve tried “Between” and “<= , >=” Statements but the results are same. Table My query For example: If i need range between “13000” and “13020” and there is number “1301” its appear in results. Answer

Extracting hashtags by sql

I have this problem – currently I am extracting hashtags in a C# application but now I want to move it to SQL Server. In C# I have code using a regex: In T-SQL, I would like to have something like this: Answer Using the string_split

How to divide 2 integers without using / operator in SQL Server? [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 23 days ago. Improve this question How can I divide two integers without using the / operator? Thank you so much for the help in advance. I will explain why this

Advertisement