sql-server-2016

Transact-SQL Select statement results with bad GUID

冷暖自知 提交于 2021-02-19 08:23:21
问题 We have a table with GUID primary keys. When I search for a specific key, I can use either: SELECT * FROM products WHERE productID='34594289-16B9-4EEF-9A1E-B35066531DE6' SELECT * FROM products WHERE productID LIKE '34594289-16B9-4EEF-9A1E-B35066531DE6' RESULT (for both): product_ID Prd_Model ------------------------------------ -------------------------------------------------- 34594289-16B9-4EEF-9A1E-B35066531DE6 LW-100 (1 row affected) We have a customer who uses our ID but adds more text

Allow login to run stored procedure without being able to select from table

非 Y 不嫁゛ 提交于 2021-02-19 05:33:44
问题 I have a SQL Server with two databases: Database1 Database2 Login 'MyLogin' has read access on Database2 only. Database2 has a stored procedure as follows: CREATE PROCEDURE Get_LogData @ProductID int AS BEGIN If Exists (Select (1) From Database2.dbo.Products Where ProductID = @ProductID) Select LogTimeStamp , ProductID , Description from Database1.dbo.Log Where ProductID = @ProductID Else Print 'Get_LogData: Unable to find ProductID ' + CAST(@ProductID AS VARCHAR) END; GO BEGIN GRANT EXEC ON

How to add HIDDEN property on column?

别等时光非礼了梦想. 提交于 2021-02-16 13:37:47
问题 When temporal table is created, we need to defined start and end date time columns which can be hidden - not visible in SELECT * or INSERT without columns . I want to add one more column, which will contain information about the user who has commit the change. The issue is, I am getting the following error: Msg 13735, Level 16, State 1, Line 10 Cannot alter HIDDEN attribute on column 'UserID' in table 'GK' because this column is not a generated always column. Here is the code: DROP TABLE IF

How to add HIDDEN property on column?

蓝咒 提交于 2021-02-16 13:37:45
问题 When temporal table is created, we need to defined start and end date time columns which can be hidden - not visible in SELECT * or INSERT without columns . I want to add one more column, which will contain information about the user who has commit the change. The issue is, I am getting the following error: Msg 13735, Level 16, State 1, Line 10 Cannot alter HIDDEN attribute on column 'UserID' in table 'GK' because this column is not a generated always column. Here is the code: DROP TABLE IF

Display data from an AlwaysEncrypted column in a NodeJS app?

跟風遠走 提交于 2021-02-10 06:26:27
问题 I have a SQL Server database in Azure that is accessed by a .NET app and by a NodeJS app . I just applied AlwaysEncrypted to a table column that contains sensitive information. I used Azure Key Vault to store the encryption key. I was wondering if it is possible to display the (decrypted) data in my NodeJS app? A workaround to this would be to expose the data that I want to query through an API endpoint in my .NET app, and then call that endpoint from my NodeJS app, but I'm looking for a more

SQL Server returns question mark for some unicode chars [duplicate]

狂风中的少年 提交于 2021-02-10 06:20:10
问题 This question already has answers here : What is the meaning of the prefix N in T-SQL statements and when should I use it? (4 answers) Closed 1 year ago . In a nvarchar(512) field if i store unicode chars like this: UPDATE MYTABLE SET UNICODEFIELD = 'TレEホSᅯTル' when i query it i get T?E?S?T? It looks like the "unusual" chars are not considered as unicode, i would expect the "?" behavior in case of varchar , while with nvarchar it should work fine, i am expecting TレEホSᅯTル as output, instead of

Missing some components in SSIS toolbox in Visual Studio 2017

旧城冷巷雨未停 提交于 2021-02-09 11:12:36
问题 I am using Visual Studio Community 2017 for developing SSIS packages and I use SQL Server 2016. Some of components are not in SSIS Toolbox. This is that I have now: and this is my colleges have(They don't have the same version of Visual Studio that I have): For example: I need to add a XML Source component to one of my Data Flow but there is not anymore in Other Sources sector in SSIS Toolbox. I tried to add the missing components (Tools -> Choose Toolbox Items ->) but I don't have the tab

Missing some components in SSIS toolbox in Visual Studio 2017

怎甘沉沦 提交于 2021-02-09 11:11:58
问题 I am using Visual Studio Community 2017 for developing SSIS packages and I use SQL Server 2016. Some of components are not in SSIS Toolbox. This is that I have now: and this is my colleges have(They don't have the same version of Visual Studio that I have): For example: I need to add a XML Source component to one of my Data Flow but there is not anymore in Other Sources sector in SSIS Toolbox. I tried to add the missing components (Tools -> Choose Toolbox Items ->) but I don't have the tab

Deploy SSIS Project using TFS Command Line

a 夏天 提交于 2021-02-08 15:11:34
问题 How do I deploy an SSIS project from TFS 2015? For regular database projects, it is sqlpackage.exe /publish with publish profile. What is the command line argument to auto deploy SSIS Project Model into a server? We are using SQL Server 2016 Enterprise. 回答1: Why using runas command?? Runas command allows a user to run specific tools and programs with different permissions than the user's current logon provides. Based on Deploy an SSIS project from the command prompt with ISDeploymentWizard

SQL Server Count records from parent category and all subcategories

白昼怎懂夜的黑 提交于 2021-02-07 19:52:16
问题 Currently I have a stored procedure where I create a table and query the table to get my desired result, the result being an infinitely tiered child/parent table that allows me to display the data on my ASP Classic based webpage. This procedure is: SET NOCOUNT ON; DECLARE @Categories TABLE( CatID INT NOT NULL, CatName VARCHAR(200) NOT NULL, ParentID INT ) INSERT INTO @Categories SELECT CatID, CatName, ParentID = NULL FROM Categories WHERE CatName NOT IN ( SELECT CatName FROM Categories c