|
|
|
|
|
|
Question of the Day |
Today's question (by Steve Jones - SSC Editor): | |
CHOOSing a value | |
I have code that looks like this:
DECLARE @i INT = 4; SELECT CHOOSE(@i, 10,20,30,3.14,50,'Test')What is returned? | |
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) |
Default Schemas A developer is unsure of what schema a table will be created under if they execute this code: CREATE TABLE SalesDetail (SalesOrderID int not null, SalesNotes varchar(max) ); How can the developer check their default schema under T-SQL? Answer: SELECT SCHEMA_NAME() Explanation: The SCHEMA_NAME() function is used with no parameter. Ref: SCHEMA_NAME - https://docs.microsoft.com/en-us/sql/t-sql/functions/schema-name-transact-sql?WT.mc_id=DP-MVP-7914&view=sql-server-ver15 |
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 - Development |
Advice on User Schema - Hello All, I have not been here on Central for a bit. The website looks great !!. Most of my SQL Career has been spent querying data for reports. Recently I decided I wanted to learn front end development. So I have been watching tutorials on Blazor/ C# etc. I have now gotten to the […] |
What is the easiest way to replace one string with another sting in 1000 files? - I need to once in a while replace a string of about 200 characters in each text file (~ 2 Mb each) with another string of similar length? There are 1000+ files in the directory, and I want to loop through each, replace the string if found, save file, move to next one, and so […] |
SQL Server 2016 - Administration |
Intermittent issue with cluster failover when SQL Agent service is restarted - Hi everyone, Some background: Very recently, we upgraded both our SQL cluster and the servers that houses it. We're now on SQL Server 2016 and Windows Server 2016. I'm the 'database administrator'; not a real one because I don't do the upgrades or make many changes to our set up, etc etc. I'm basically here […] |
Extended events - Q1. Lets say I want to audit DDL , DML, DCL, DQL statements Can we use extended events to create an auditing solution in SQL Server for such a requirement ? Or are there better/efficient not so resource intensive alternatives ? Thanks Q2. What is best way to audit any account which connects to a […] |
SQL Server 2016 - Development and T-SQL |
Date Dimension - I'm in the process of creating a date dimension table with the usual fields such as DayOfWeek, DayOfMonth, DayName, IsHoliday, various different formats of date, etc. Much of our reporting relies on trending data and comparing to previous month(s), quarter(s), or year(s) and also month-to-date, quarter-to-date, and year-to-date indicators. There would also be a need […] |
Saving output as SQL file - If anyone is working today I have a problem I'm working on. I have a script which when run in SSMS, generates a SQL update script which is saved as an SQL file and run later. I am trying to automate this processes and generate a SQL file. Based on what I've found in google […] |
Incorrect Syntax near ) - Hi On below code i get above error select T0.DocEntry,T0.DocDate,T0.CardCode ,T1.ItemCode, ,Coalesce((Case When T4.Street = '' Then Null Else T4.Street + ' ' End) + ',' + CHAR(10) + ',' + (Case When T4.Block = '' Then Null Else T4.Block + ' ' End) + ',' + CHAR(10) + ',' + (Case When T4.ZipCode = […] |
Administration - SQL Server 2014 |
DACPAC StoredProc update - Hi, I am struggling to push stored proc changes to database through dacpac. If I set the build action to build it's throwing errors, the statement is not recognized in this context and build fails. If I set it to none, build succeeds and no changes are pushed to database. How to fix this? |
Development - SQL Server 2014 |
Difference between where and INNER JOIN comparing a value - what is the difference between : Declare Phone varchar(50) UPDATE e Set e.[State]=2 FROM Events e INNER JOIN AccoutsAndPhones c on e.ClientID=c.ClientID And c.phone=@Phone WHERE e.Schedule>GETDATE() and Declare Phone varchar(50) UPDATE e Set e.[State]=2 FROM Events e INNER JOIN AccoutsAndPhones c on e.ClientID=c.ClientID WHERE e.Schedule>GETDATE() and c.phone=@Phone the c.phone=@Phone is in different places. is […] |
SQL 2012 - General |
Importing a CSV files in SSMS - Hi, My manger uses the SSMS import to import his CSV files. he has one file he just got that has, like most carriage retunes and line feeds in them. For some reason he wants to import the file with the carriage retunes, but not the line feeds. I think you can, during the import state the row […] |
SQL Server 2019 - Administration |
SSIS Catalog vs Lift & Shift SSIS in ADF - Hi, We used to be able to create SSISDB from Integration Services Catalogs within SSMS. This option has been changed that we can only create SSIS IR which is the Lift & Shift Your ETL Workload with SSIS in ADF. This option requires us to sign in and subscribe SQL Azure. We would like to […] |
Confused on 2019 and containers - H/A - Hi We currently have a SQL2014 environment with 2 on premise and one DR server in another state - all connected via High Availability. Looking towards the future - I'm looking for a way to eliminate or improve our DR site that is in another state. After upgrading to SQL2019 would it then be possible […] |
SQL Server 2019 - Development |
Check if date column are in order - Hi, Thanks in advance. I have a datetime column in a table. I want to run a query to get a true or false value.. true if the datetimes in the table are in date order, and false if they are not in date order. Thank you. |
SQL Newbie Help - Why can I not create a new column and add 90 days to the date in column P_INDATE in MS SQL Server? I believe you can do this in MySQL. The P_INDATE has a data type of Date. |
Integration Services |
Data Migration to S/4 Hana - Hi , I Would like to migrate the data from Flat files to the S/4 Hana database . Can i do that using the ODBC connection? If some one has implemented it or has any knowledge can you please share your experiences or steps to be implemented using SSIS ? I am assuming that we […] |
| |
©2019 Redgate Software Ltd, Newnham House, Cambridge Business Park, Cambridge, CB4 0WZ, United Kingdom. All rights reserved. webmaster@sqlservercentral.com |