Skip to content

Tag: sql-server

Alter column default value

I know you can change the default value of an existing column like this: But according to this my query supposed to work: So here I’m trying to make my column Not Null and also set the Default value. But getting Incoorect Syntax Error near CONSTRAINT. Am I missing sth? Answer I think issue here is with …

SQL Server range indexing ideas

I need help understanding how to create proper indexing on a table for fast range selects. I have a table with the following columns: Column — Type frameidx — int u — int v — int x — float(53) y — float(53) z — float(53) None of these columns is unique. There are to b…

SQL Update if parameter is not null or empty

I searched some ways to check if a SQL Server parameter is not null or empty but I’m not sure what’s the best way to use this when updating several columns: I had this code at first that was updating without checking for empty or Null values: Then I added an IF clause before updating, it is workin…

Trying to get a single record involving MAX(Date) and GROUP

I am trying to create a query in which I start with an item number and a customer and I have to determine the last selling price. The tables involved are SOP30200 = Sales Header SOP30300 = Sales Detail lines Given the following code and results: CODE: RESULTS: I am getting 2 records because the query is group…