Skip to content
Advertisement

Tag: tsql

Check whether a number is in a string range

I have a table ID Count Range 1 33 1-100 2 120 101-200 3 155 201-300 The Range is a string that can only have the values 1-100, 101-200, 201-300. I need to write a query that checks whether the count and the range fits, so 155 should pop up. My idea was: but this does not work. Can anyone

Combine two tables with different columns and data

How can I combine two tables with different data and set value for CompanyC to all data in Table 2 even there is no relationship of CompanyC on Table2. And the Result Table would be like: I already tried this and it is working but the problem is since CompanyC has no data on Table 2. The result will be

Procedure with cursor has missing output

I am working on an SQL Server procedure that I would like to have print the department name and students name Similar to the attached snippet The formatting should look like the attached sample snippet and there are two columns involved. students and department tables. The problem is that the results are incomplete/seems to be getting cut off below is

Advertisement