|
|
|
|
|
|
|
Question of the Day |
Today's question (by Steve Jones - SSC Editor): | |
Using mode() in R | |
What does the function, mode(), do in R? As in: > i [1] 26 > mode(i) | |
Think you know the answer? Click here, and find out if you are right. |
Yesterday's Question of the Day (by Steve Jones - SSC Editor) |
Adding N/A I have a query that returns sales totals from a table. My query is: SELECT ms.saleyear , ms.salemonth , ms.currMonthSales , LAG (ms.currMonthSales, 1) OVER (ORDER BY ms.saleyear , ms.salemonth) AS prevsales FROM dbo.MonthSales AS ms ORDER BY ms.saleyear DESC, ms.salemonth desc; The currMonthSales value is a numeric value. I want this to display "N/A" when the value is NULL. What should I do to the query? Answer: Add a COALESCE and a CAST to varchar around the LAG function Explanation: The COALESCE function will convert this value, but you cannot add a string data type to a column that returns numerics. Instead, you need to cast the output of LAG to string (VARCHAR) and then COALESCE around that. Ref:
|
Database Pros Who Need Your Help |
Here's a few of the new posts today on the forums. To see more, visit the forums. |
SQL Server 2017 - Administration |
"SQL Server Windows NT - 64 bit" in Task Manager: Memory and CPU high - Hello, It's weird that suddenly I can't access to my sql server database (it says it's being recovered) and i found that the sql service is using a LOT OF my memory and disk in the task manager Could any one help me please to resolve this ? Thank you |
SQL Server 2017 - Development |
Concatenate columns with spl characters - Hi, In order to avoid redundant rows, I have to make the following changes to my SQL code : For the same Quarters,Function, Product and Manager combination we want to update the [GM Scope] and [BL Scope] column as follows : 1) If Quarters,Function, Product and Manager are identical, then GM Scope should show […] |
SQL Server 2016 - Administration |
object_name (st.objectid) returns NULL. How can I overcome/fix this? - How can I overcome/fix this? object_name (st.objectid) in the code below returns NULL. (in the below query, as well as any other similar queries..). White paper says "A user can only view the metadata of securables that the user owns or on which the user has been granted permission. This means that metadata-emitting, built-in functions […] |
How can I prepare SQL server 2016 certification? - How can I prepare SQL server 2016 certification? Answer Follow · 12 Request plzz guide me. |
Development - SQL Server 2014 |
trigger email alerts in case file is delivered or failed for the job - Hi all, I have two SQL jobs. These jobs execute SSIS packages and then send files to e-mail. I need to create one more SQL Job that would be send an alter to email about file delivering (file was success delivered or not). Could you help me? Thanks |
SQL 2012 - General |
List all stored procedures which return datasets - Is there any way to do that? I need to list that kind of procedures in a list on a application form. There is more than 1500 procedures in the DB, most of which are returning result but not dataset. Is it at all possible? Thank you |
SQL Server 2019 - Administration |
Creating an Extended Event in a SQL Managed Instance - Recently moved our environment to SQL 2019 Managed Instance from SQL 2017 environment. Trying to re-setup the Extended Event we had running to capture Deadlocks but having issues using an Azure Data Blob for storing the Extended Event file. The initial creation finally worked but when trying to start it get the following error: "The […] |
Developer vs Enterprise - Hi Experts, Is there any difference between Developer & Enterprise Edition of SQL Server (2019 ,2017 & 2014) both in features & performance wise? TIA |
SQL Server 2019 - Development |
Newb - SQL Server IIF() Function - I am using the following function: IIf([var1Title] != '', [var1Title] + ' - ' + [var1Topic] + ' - ' + [var1Name], '') AS Item1 In some cases, the value of var1Name is NULL. Oddly, when var1Name is NULL, the value retuned for the entire line is NULL. I am hoping the value returned would […] |
Looking for US state geospatial shape data - We have a request to calculate distances across states for a given line between 2 points. Example a line from Minneapolis to Los Angeles, I need to know the total length and what percentage of that length is within each state it crosses. I know how to do it but I need the state outlines. […] |
SQL Server 2008 - General |
SQL Server maximum Server Memory - I am using SQL Server 2008 R2 Express edition. I have already set Maximum Server memory to 2Gb. Is there any benefit if I Change it from 2Gb to 3Gb? |
Reporting Services |
SSRS Export to separate pdfs - Hi everyone, can anyone tell me the process of how to create multiple pdf's from an SSRS report ? Each pdf should refer to one student . Thank you. I tried doing data driven expressions , but got stuck with the "File name, Path, Render Format, Write mode, File Extension, User name, Password, Use […] |
Reporting Services 2008/R2 Administration |
how to configure Database Mirroring in SQL Server 2008 - sorry to bother all! could you please tell me the following concerns about database mirroring in SQL server 2008 ? thanks! how to configure the database mirroring for SQL Server 2008 without witness server under not windows domain environment? how to configure the database mirroring for SQL Server 2008 without witness server under windows domain […] |
Integration Services |
Missing connections not causing a job failure - Hello I have a package that logs using Configure SSIS Logs: Logging It logs to a database (log) I've set up a new connection to the DB and called this log I've created a config file and added log to this: log So, if I create a job that runs […] |
SQLServerCentral.com Website Issues |
how do you change your display name? - When I edit my profile the display name field is a dropdown. How can I change my display name to something not in the list? |
| |
©2019 Redgate Software Ltd, Newnham House, Cambridge Business Park, Cambridge, CB4 0WZ, United Kingdom. All rights reserved. [email protected] |