Business Apps
28 TopicsCatch Error in a SQL Server Logon Trigger
I have written a Logon trigger in a SQL Server to control logon authorization. ALTER TRIGGER [LOG_TRG_01] ON ALL SERVER WITH EXECUTE AS 'SA' FOR LOGON AS BEGIN if ORIGINAL_LOGIN() = 'sa' begin return; end; if ORIGINAL_LOGIN() = 'OMEGACAEVDEV1' begin -- not allowed to logon rollback; end; -- Insert Trail EXEC [OmegaCoreAudit].[OMEGACA].[P_ACC_UNF_TRAIL] 0, 'trail_details', 'ip', 'server', 'db', 0 ; END GO It does (as expected): OMEGACAEVDEV1 is not allowed to logon OMEGACAEVDEV2 is allowed to logon An audit event is inserted by proc P_ACC_UNF_TRAIL in a table for both users. All three above I want to stay this way ! But I need to have error handling in it, so that in case of whatever error the login is allowed to login - but keeping a record on another table named SYS_ERROR_LOG (with error details). In this trigger I have intentionally provoked an error by "select 10/0" The new trigger is: ALTER TRIGGER [LOG_TRG_02] ON ALL SERVER WITH EXECUTE AS 'SA' FOR LOGON AS BEGIN BEGIN TRY if ORIGINAL_LOGIN() = 'sa' begin return; end; --provoke error select 10/0; if ORIGINAL_LOGIN() = 'OMEGACAEVDEV1' begin -- not allowed to logon rollback; end; -- Insert Trail EXEC [OmegaCoreAudit].[OMEGACA].[P_ACC_UNF_TRAIL] 0, 'trail_details', 'ip', 'server', 'db', 0 ; END TRY BEGIN CATCH Insert into OmegaCoreAudit.OMEGACA.SYS_ERROR_LOG ([LOGIN_USER_NAME], [DB_USER_NAME], [USERHOST], [IP_ADDRESS], [OS_USER], [BG_JOB_ID], [ERROR_DATA]) values ('LOGIN_NAME', 'USER_NAME', 'USER_HOST', 'IP', NULL, NULL, 'ERROR_MESSAGE'); END CATCH END GO In the above code "if ORIGINAL_LOGIN() = 'OMEGACAEVDEV1'" represents a simplified version of a wider authorization process. Problem: CATCH is not working. Both users are not allowed to logon ("Logon failed for login '[user]' due to trigger execution") No record is written on table SYS_ERROR_LOG. I was expecting one for each user. What can I do to fix this problem? best regards AltinSolved407Views0likes13CommentsSQL Server Can't activate (GUID Should contain 32 digits with 4 dashes)
Hi Everyone, I'm new here and wanted to ask if anyone has encountered an error when activating a product key for SQL Server Standard 2024? If so, could you please share the solution you used to resolve the issue? Thank you.369Views0likes1Comment百家乐客服【微QGY889889】
SQL Server 是一个关系数据库管理系统。它最初是由Microsoft Sybase 和Ashton-Tate三家公司共同开发的,于 Microsoft SQL Server Microsoft SQL Server 1988 年推出了第一个OS/2 版本。在Windows NT 推出后,Microsoft与Sybase 在SQL Server 的开发上就分道扬镳了,Microsoft 将SQL Server 移植到Windows NT系统上,专注于开发推广SQL Server 的Windows NT 版本。Sybase 则较专注于SQL Server在UNIX 操作系统上的应用。 SQL Server 2000 是Microsoft 公司推出的SQL Server 数据库管理系统,该版本继承了SQL Server 7.0 版本的优点,同时又比它增加了许多更先进的功能。具有使用方便可伸缩性好与相关软件集成程度高等优点,可跨越从运行Microsoft Windows 98 的膝上型电脑到运行Microsoft Windows 2000 的大型多处理器的服务器等多种平台使用。 SQL Server 2005 SQL Server 2005 是一个全面的数据库平台,使用集成的商业智能 (BI) 工具提供了企业级的数据管理。SQL Server 2005 数据库引擎为关系型数据和结构化数据提供了更安全可靠的存储功能,使您可以构建和管理用于业务的高可用和高性能的数据应用程序。 SQL Server 2005 数据引擎是本企业数据管理解决方案的核心。此外 SQL Server 2005 结合了分析、报表、集成和通知功能。这使您的企业可以构建和部署经济有效的 BI 解决方案,帮助您的团队通过记分卡、Dashboard、Web services 和移动设备将数据应用推向业务的各个领域。 与 Microsoft Visual Studio、Microsoft Office System 以及新的开发工具包(包括 Business Intelligence Development Studio)的紧密集成使 SQL Server 2005 与众不同。无论您是开发人员、数据库管理员、信息工作者还是决策者,SQL Server 2005 都可以为您提供创新的解决方案,帮助您从数据中更多地获益。 SQL Server 2008 SQL Server 2008是一个重大的产品版本,它推出了许多新的特性和关键的改进,使得它成为至今为止的最强大 和最全面的SQL Server版本。这篇文章详细介绍了Microsoft SQL Server 2008中的新的特性、优点和功能。 微软的这个数据平台满足这些数据爆炸和下一代数据驱动应用程序的需求,支持数据平台愿景:关键任务企业数据平台、动态开发、关系数据和商业智能。 SQL Server的愿景 许多因素致使产生了信息存储爆炸。有了新的信息类型,例如图片和视频的数字化,和从RFID标签获得的传感器信息,公司的数字信息的数量在急剧增长。遵守规范和全球化的发展要求信息存储的安全性和在任何时候都可用。同时,磁盘存储的成本显著地降低了,使得公司投资的每一美元可以存储更多的数据。用户必须快速的在大量的数据中找到相关的信息。此外,他们想在任何设备上使用这个信息,并且计划每天使用,例如Microsoft Office系统应用程序。对数据爆炸和用户期望值的增加的管理为公司制造了许多挑战。 Microsoft 数据平台愿景提供了一个解决方案来满足这些需求,这个解决方案就是公司可以使用存储和管理许多数据类型,包括XML、e-mail、时间/日历、文件、文档、地理等等,同时提供一个丰富的服务集合来与数据交互作用:搜索、查询、数据分析、报表、数据整合,和强大的同步功能。用户可以访问从创建到存档于任何设备的信息,从桌面到移动设备的信息204Views0likes0CommentsAccess to Sql Server Migration
I am trying to come up with Access code that will allow a query to migrate to Sql Server. The current Access Sql is: SELECT Last(tblSecurityPrices.Price) AS LastOfPrice, tblSecurityPrices.Security, Last(tblSecurityPrices.PriceDate) AS LastOfPriceDate FROM tblSecurityPrices GROUP BY tblSecurityPrices.Security; I know very little about Sql Server. BobSolved696Views0likes1CommentWhat front end for Sq; Server
I am converting a MS Access tables and queries to Sql Server back end. The app is a personal finance app. When completed the back end will be cloud based. Then, I will convert the MS Access front end to cross platform(windows, Mac, Google and Linux with compatibility with Android and IOS. I don't know what language to use for this front end. I am a self taught developer and I know that I am not the best or fastest and would have to learn the language. What language would you recommend and why?336Views0likes0CommentsSQL Server Express
On my Windows 10 PCs I have been using for many years a third party application (Veeam Agent for Microsoft Windows) that used to depend on Microsoft SQL Server Express. SQL Server Express was installed during Veeam Agent installation. The latest release of Veeam Agent does not use anymore SQL Express, so I could uninstall it if not used by other applications. Given that I have lots of applications on my PCs, how can I check that none uses SQL Express before uninstalling it? Regards1.5KViews0likes2CommentsSQL Server Agent is not starting after in place upgrade of SQL server from 2012 to 2019
SQL Server Agent is not starting after in place upgrade of SQL server from 2012 to 2019 I have done in place upgrade of SQL server from SQL 2012 Standard Edition (64-bit) SP4 to Microsoft SQL Server 2019 (RTM) - 15.0.2000.5 (X 64) Sep 24 2019 13:48:23 Copyright (C) 2019 Microsoft Corporation Standard Edition (64-bit) on Windows Server 2019 Datacenter 10.0 <X 64> (Build 17763: ) (Hypervisor). But after upgradation, sql server agent is in stopped state. I have tried with Local system account also but still no luck. Error in windows event logs is SQLServerAgent could not be started (reason: SQLServerAgent cannot start because the msdb database is read-only). I have checked and confirm that msdb database is not in read only state. Can someone help me to resolve this issue.1.1KViews0likes0CommentsExecuting SQL trigger doesn't work if triggering events are generated by Azure Data Factory
Good day everyone, I have an issue getting data from Azure Data Factory into SQL. My original solution of using power automate was stymied by the combination of a mysteriously slow Stored Procedure when running it from Power Automate vs SSMS and the hard coded 2 minute timeout in flows. So my next idea was to run the SP from a trigger whenever records are inserted into a staging table from data factory using Copy Data action. *The trigger works fine when adding records in SSMS *The Data Factory pipeline successfully inserts rows into the staging table *After successful inserts from DF, the trigger in SQL on that staging table does not fire. Is this a bug? How can I work around this? And finally, is there a better way that doesn't involve deploying more services/licenses? Edit: To clarify what I' masking about. Key scenario I am attempting is in bold above. However, I have just decided to run the SP from Data Factory and pay the fees to run it. I don't have any more time to waste trying to troubleshoot.2KViews0likes2CommentsNull Question
Hello Guys, i am totally new and just started SQL 1 weeks age i have come across a problem in SQL suppose i am working on huge amount of data which is unclean and i want to find NULL & i know the syntax of null but suppose i have almost 50 columns and i want to find out in which row there is NULL is there any we can find NULL or Blank field in this vast data because it will take a lot of time if i just put null syntax and writing one by one column877Views0likes1Comment