Skip to content

Tag: sql-server

How to get only comma values in SQL Server

I have a employee table and I am trying to get only comma values in SQL Server. Emp table: Eid Ename 1 Peter,J 2 Mike,S 3 , 4 ,,,,,, I tried this code: I am not getting the length 0 if the values contain only commas. Expected result: I want only 3 and 4 emp ids. Answer The answer there

Add geometry column from exisiting x,y,z columns

I have a table as such: All columns are Decimal(18, 3), there are also millions of rows. I would like to add a fourth column to be a geometry point. I have tried but to no avail: Driving me insane! Cheers Answer As mentioned by @lptr in the comments, you can use STPointFromText db<>fiddle

sql update – access to the current row

I would like update the column [ACIdent] from the table [Values]. With the subquery i try to get an ID from the same table. On the point ??? i try to access to the column [PathName] of the respective row of the update script. But this solution doesn’t work. How can i do this? Many thanks in advance! Ans…

Using one query’s result into another

I have this query which shows the below result, I want to use this MarksObtained and take out min, max and avg of each course and show it with the second query (have provided below). This is the second query So it will basically show min, max and avg of each course achieved by the students. What I want: Sampl…

How to make a composite key out of two foreign keys

I have three tables: In Table 1 primary key is pizza and in Table 2 ingredient. In Table 3, pizza and ingredient are foreign keys, that reference Table 1 and Table 2 respectively, and i want to make them into a composite key. Here’s what i tried: But i’m not sure whether it’s a correct imple…