|
|
|
|
|
|
|
|
Question of the Day |
Today's question (by Steve Jones - SSC Editor): | |
Missing Chinese Surnames | |
I have some code I used for testing some non-Latin data:
CREATE TABLE dbo.CustomerFromChina ( customerid INT NOT NULL CONSTRAINT CustomerFromChinaPK PRIMARY KEY , customersurname nvarchar(100) ) GO INSERT dbo.CustomerFromChina (customerid, customersurname) VALUES (1, '陈'), (2, '杨'), (3, '赵'), (4, '黄') GOWhen I query this in SSMS and get text results, I see these results: customerid customersurname 1 ? 2 ? 3 ? 4 ?What's wrong? | |
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) |
Changing Context in Procs I log into a SQL Server 2019 database with my AD account, named 'dkr\Steve'. I then execute this code: CREATE LOGIN way0utwest WITH PASSWORD = 'horsestakework'; GO CREATE USER way0utwest; GO CREATE OR ALTER PROCEDURE SillyProc AS BEGIN EXECUTE AS LOGIN = 'way0utwest'; END GO EXEC SillyProc; SELECT SYSTEM_USER; REVERT; What is returned by the SELECT? Answer: dkr\Steve Explanation: The EXECUTE AS works in the procedure, but only in that scope. When control returns to the caller, the original login name is returned, which is 'dkr\Steve' Ref: EXECUTE AS - https://learn.microsoft.com/en-us/sql/t-sql/statements/execute-as-transact-sql?view=sql-server-ver16 |
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 2012 - General |
Can I install SQL failover on a single node WSFC cluster? - For depressing reasons, I'm installing 2012. Don't ask. For some other reasons I've had to create a single node WSFC cluster (& will add a node later). I want to install SQL FCI (not standalone) but I'm struggling. It could be lots of things, group policy, permissions ... but ... Q 1 - is it […] |
SQL Server 2019 - Administration |
List SPN for NT Service\MSSQLServer account - Does anyone know how to list the SPN for the NT Service\MSSQLServer account ? I've created the following combinations and nothing is working setspn -L MSSQLSERVER setspn -L NT Service\MSSQLSERVER setspn -L "NT Service\MSSQLSERVER" setspn -L 'NT Service\MSSQLSERVER' When the VM was created via terraform the NT Service\MSSQLSERVER account was used to run the service […] |
File extensions errors - Processed: Jun 27 2023 3:02AM, LogDate: Jun 27 2023 3:01AM, Server: [WARNING] === At least 4 extensions for file {XXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXX} (sql\ntdbms\hekaton\engine\hadr\mtlog.cpp : 6063) What do the above warnings mean? Do they need to be investigated - if yes-how do we troubleshoot them or can they be ignored. Thanks |
SQL Server 2019 - Development |
Arithmetic overflow error when using POWER function - Hello, Any help appreciated. This code should perform a internal rate of return (IRR) calculation. It generates correct data based on what was provided to me using Excel's IRR function. It looks like as GETDATE() gets close to my hard coded date the error is generated. Any suggestion to prevent the error would be appreciated. […] |
Preventing Arithmetic overflow error when using POWER function - Hello, Any help appreciated. This code should perform a internal rate of return (IRR) calculation. It generates correct data based on what was provided to me using Excel's IRR function. It looks like as GETDATE() gets close to my hard coded date the error is generated. Any suggestion to prevent the error would be appreciated. […] |
Update view from dynamic sql - I'm using the code below to change the name of the columns in a view but it doesn't actually update the view. What do I need to do so that the view is updated? Thanks. DECLARE @code4 VARCHAR(9); SET @code4 = CONVERT(VARCHAR(2),month(DATEADD(MONTH,DATEDIFF(MONTH, 0, GETDATE()) - 4, 0))) + ' - ' +CONVERT(VARCHAR(4),year(DATEADD(MONTH,DATEDIFF(MONTH, 0, GETDATE()) […] |
DELETE with SELECT and join in SQL SERVER - I have a select statement below which gives the expected results of duplicate data. I want to convert this statement to a DELETE Statement to delete items leaving a single item but getting error. Below is my query. Sample data SampleOne 2016-10-14 12:44:39.460 SampleOne 2016-10-14 12:44:39.460 SampleTwo 2016-10-14 12:44:39.460 SampleTwo 2016-10-14 12:44:39.460 SELECT t.* FROM […] |
Out of 3 same/ similar rows, remove two and keep one - Hello everyone, I would like to ask someone for an advice. I am not even a 100% sure it is doable, but it might be. I have a table that returns the same or almost the same rows of information often times 3 times. Basically there are 3 types of Transactions: 1. GL Posted - […] |
SQL Azure - Administration |
How to read file metadata from an Azure Blob location? - Anyone recommend the best way to accomplish this? Powershell? Or can you do this via external data sources? All I need to do is read file metadata from folders in azure blob storage so I can get the filename and date file created for audit purposes. Thanks in advance! |
Reporting Services |
SSRS reports URL in database - We would like to include userID in the reportURL, so that later we can see the report execution data for specific users. I know we can query the database using ExecutionLog3, but I don't see a URL field included. Any where store that information, what is the best way to get report execution counts for […] |
Integration Services |
How to skip Deleted Servers - I have a SQL table with some servers and a package which runs of those servers. 1.Execute task to list the servers from the table. 2.For each loopcontainer inside which I have data flow task which in turn has oledbsource and oledbdestination. The package runs fine when all servers are present.If a server is deleted […] |
T-SQL |
Use BCP and a format file to export data to a text file - I would like to use BCP and a format file to export data to a text file in a fixed length format. Fields export. The length and starting and ending position. Last Name Length 20 Position 1-20 First Name Length 15 Position 21-36 Social Security Number Length 9 Position 37 46 AddressLine1 Length 30 Position […] |
SQL Server 2022 - Administration |
SQL Server running on Linux, instance starts almost 2 mins after the service - SQL Server (2022) running on Linux (SuSE 15.4), instance starts almost 2 mins after the service. When the system starts, systemctl status mssql-server.service reports, something like Active: active (running) since Wed 2023-06-28 15:47:57 UTC; 2min 43s ago However, sql server is not available immidately, has to wait almost 2 mins before can be queried. When […] |
SQL Server 2022 - Development |
how to identify sql scripts not in stored procs w/o using trace - I'm storing off various stats about procs on a daily basis. On e of them stores each sql statement in each proc w/ runtimes and other information. My issue is there are power bi reports and sql job step that are not using procs but have embedded the sql scripts directly in them . […] |
issue with text column in dbo.syscomments - I wrote a process to store off all sql objects daily. There is one that stores off all stored procedures contents daily. The text column in the dbo.syscomments table is being stored locally in another table whose column is a varchar(max). It stores each proc in 4000 char chunks. So there will be one record […] |
| |
©2019 Redgate Software Ltd, Newnham House, Cambridge Business Park, Cambridge, CB4 0WZ, United Kingdom. All rights reserved. webmaster@sqlservercentral.com |