|
|
|
|
|
|
|
Question of the Day |
Today's question (by Steve Jones - SSC Editor): | |
Multiple Lambda Parameters in Python | |
I want to create a python lambda expression that will concatenate two parameters into a string with proper casing. I want the parameters to be givenname and surname. The formula I will use is:
f'{sname.title()}, {gname.title()}'How do I define a lambda with two parameters? | |
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) |
The Double Table I have this code: CREATE TABLE dbo.DoubleTable ( myid INT NOT NULL CONSTRAINT DoubleTable PRIMARY KEY , Val VARCHAR(20)); GO When I run this, I get this error: Msg 2714, Level 16, State 5, Line 19 There is already an object named 'DoubleTable' in the database. Msg 1750, Level 16, State 1, Line 19 Could not create constraint or index. See previous errors. Why? Answer: There is an object name conflict Explanation: There isn't another table already, but there is a table created by the CREATE TABLE statement, and then when the constraint tries to be created, there is an object name collision. The constraint and the table cannot have the same name. Ref: Table Constraints - https://docs.microsoft.com/en-us/sql/t-sql/statements/alter-table-table-constraint-transact-sql?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 |
Replace hexidecimal value wih '§' or blank in a TEXT field - I have a DB with a field defined as: dag_text text allow nulls I have an hexadecimal value (0x15) placed some hundred places in the table. It should be replaced with '§' . In comes REPLACE, but it does not work on text fields. the offending tekst look like(Its the that should be replaces with […] |
Conditional Update of Column - I can't remember ever trying this before, but I have need to do it now. I need to update a specific column in a table based on data in another table. The column to be updated varies. Some code will explain better: DROP TABLE IF EXISTS #sample; CREATE TABLE #sample ( PK CHAR(3) NOT NULL […] |
SQL Server 2016 - Administration |
How to limit SQL Job Success events - Hi, We have a monitoring tool that reads Windows Event Log entries for Failure and Success of SQL Job executions. So, we have setup MSSQL jobs to write to the Windows Event Log when they fail or complete successfully. This works okay, however for jobs that run at a very high frequency I find that […] |
CPU and Memory issues - I am a DBA trying to get to the bottom of some instances when we have hit high CPU for a sustained period impacting performance. On our spotlight monitoring tool we use, when we hit 100 CPU for a sustained time I see that the procedure cache has dropped significantly from 5GB down to MBs, […] |
SQL Server 2019 - Administration |
Batchmode on rowstore: deadlock - Are there known issues with Batchmode on rowstore in CU11? One specific complex query is getting "Transaction (Process ID 65) was deadlocked on generic waitable object resources with another process and has been chosen as the deadlock victim. Rerun the transaction." The deadlock sofar triggers when the optimizer decides to go for BatchModeOnRowStoreUsed="true" OPTION(USE HINT('DISALLOW_BATCH_MODE')) […] |
Error shrinking database - While trying to shrink a database using the command "dbcc shrinkdatabase ([db_name])", I get the following message "DBCC SHRINKDATABASE: File ID 1 of database ID 13 was skipped because the file does not have enough free space to reclaim." That seems to be case with few other DBs too. I was web searching and came […] |
Are Powerplans still relevant for VM servers? - Hello, I am rolling out a new monitoring environment. While in testing, it is alerting on high performance plan not enabled. I did some research and found a lot of articles on improving SQL Server performance changing the powerplan from balanced to high performance. When I asked our platform team about the power plans, they […] |
Login failed: Password did not match that for the login provided. - I just installed a new instance of SQL Developer Edition - All my apps run on SQL Express and I am testing them on the new Edition. My Web Service connects to the new instance, my integration tests can access the new instance... However For a Windows Service - I get this error every time […] |
SQL Server 2019 - Development |
Having sum(amount) = 0 returns negatives as well. - Hello all, I'm trying to get a list of ID's that have a total sum of their amount column = to zero... But I'm getting a lot of negative numbers, but no positives. So, for example, I might get an ID that has two rows in total which if you add up their amounts it […] |
Monitor data and update it conditionally - Hi, Is there a way for monitoring data in a table and update it when it exists in the table longer than a period of time? For example, a table has a column called "measure", if the column contained value > 0 longer than 15 minutes then update it to be 0. Any help would […] |
Azure Data Factory |
Extract bearer token from a string ADF and APIs - Hi all I just wondered if there was a way to extract only the bearer token of the below string into a variable. I have a variable @activity('GetToken').output.accessToken When I run the task I get the following value into my variable. { "name": "token", "value": "eyJhbGciOiJSUzI1NiJ9.eyJqdGkiOiI0MDAiLCJpYXQiOjE2Mjc1NTM1MTcsImlzcyI6ImF" } What I want to do now though is […] |
Reporting Services |
Aging report with days parameter - I created an aging report for a case management system with a single parameter @days with values 30,60,90 etc. and the following where clause WHERE DateOpened <= Getdate() - @days This worked fine but the user rather than return rows for the last 60 or 90 days wants cases between 30-60 days or 60-90 days. […] |
General |
SELECT records from table 1 that does not exist in table 2 via UNION - Sorry if this seems too beginner; I have been stuck at this for days and for some reason couldn't figure out the answer. Suppose I have tbl Customers and tbl Orders. The relationship is that 1 customer can have many or no orders. I have to use UNION, to retrieve customer records that does not […] |
Powershell |
SQL Server Agent producing unreproducible error - I've built a Powershell script, which I want to run through SQL Server Agent. The script works fine in multiple environments: My own local environment using Powershell 7.1 My own local environment using Powershell 5 SQL Server host using Powershell 4 As soon as, however, I ask the script to be run through agent it […] |
BulkCopy error - I'm trying to load a csv to SQL using the BULKCOPY, but running into a issue load the string value into a Float within SQL I build a Data Table then load from there. The data from the csv has values like .247888 Thanks. |
| |
©2019 Redgate Software Ltd, Newnham House, Cambridge Business Park, Cambridge, CB4 0WZ, United Kingdom. All rights reserved. webmaster@sqlservercentral.com |