or:
SELECT coalesce(MAX(X), 0) AS MaxX
FROM tbl
WHERE XID = 1
More Related Contents:
- Find number of days that intersect a given date range in a table of date ranges
- How to extrapolate dates in SQL Server to calculate the daily counts?
- Insert results of a stored procedure into a temporary table
- Best approach to remove time part of datetime in SQL Server
- Difference between JOIN and INNER JOIN
- Is there a way to access the “previous row” value in a SELECT statement?
- Remove Identity from a column in a table
- How to create multiple one to one’s
- efficient way to implement paging
- SQL Server – transactions roll back on error?
- Formatting Numbers by padding with leading zeros in SQL Server
- SQL Case Sensitive String Compare
- Difference between a User and a Login in SQL Server
- Exporting data In SQL Server as INSERT INTO
- Convert Comma Separated column value to rows
- SQL Server : dynamic pivot over 5 columns
- For Nvarchar(Max) I am only getting 4000 characters in TSQL?
- Postgres Case Sensitivity
- How do I query for all dates greater than a certain date in SQL Server?
- Check If the string contains accented characters in SQL?
- Count based on condition in SQL Server
- Does Sql JOIN order affect performance?
- What does sp_reset_connection do?
- Syntax of for-loop in SQL Server
- Using tuples in SQL “IN” clause
- Replace first occurrence of substring in a string in SQL
- Why does ISNUMERIC(‘.’) return 1?
- How to correctly insert newline in nvarchar [duplicate]
- How do you copy a record in a SQL table but swap out the unique id of the new row?
- Using IF ELSE statement based on Count to execute different Insert statements