sql-server

SQL LIKE operator not showing any result when it should

浪尽此生 提交于 2021-02-19 13:03:47
问题 I got a Vehicle table with lots of info but one of the columns being 'Owner' in a MSSQL table But one of the owners i can't select when i use LIKE but can if i use = 'Silkeborg Distributionscenter' is the owner (Yes there is a double space in both the table and the param) So the param is: DECLARE @Owners nvarchar(MAX) = 'Silkeborg Distributionscenter' I tried: SELECT * FROM Vehicle WHERE @Owners = Owner --This gave me all the correct results Then: SELECT * FROM Vehicle WHERE @Owners LIKE

SQL LIKE operator not showing any result when it should

生来就可爱ヽ(ⅴ<●) 提交于 2021-02-19 12:54:34
问题 I got a Vehicle table with lots of info but one of the columns being 'Owner' in a MSSQL table But one of the owners i can't select when i use LIKE but can if i use = 'Silkeborg Distributionscenter' is the owner (Yes there is a double space in both the table and the param) So the param is: DECLARE @Owners nvarchar(MAX) = 'Silkeborg Distributionscenter' I tried: SELECT * FROM Vehicle WHERE @Owners = Owner --This gave me all the correct results Then: SELECT * FROM Vehicle WHERE @Owners LIKE

SQL deployment automation

99封情书 提交于 2021-02-19 11:51:31
问题 I am trying to automate existing sql server database deployment automation using Jenkins. One of the ways to automate is to include the SQL scripts (stored procedures, views, table creation) in a SQL server Database project using Visual Studio. Use MSBuild to build the project and deploy dacpac using SQLPackage.exe. However, the existing database has reference to other databases inside Stored Procedures/Views so I have import other databases inside the SQL Server Database project.

Conversion failed when converting the nvarchar value to data type int - Error Message

纵饮孤独 提交于 2021-02-19 09:13:22
问题 My Query Select * from MyTable The table consists 300k rows. It runs for 200k+ rows and this error pops up. How to handle this to get the full data? Does MyTable have any computed columns? Table consists of a computed column with the name IsExceeds which is given below for your reference. This is the computed column formula: (CONVERT([int],[Pro_PCT])-CONVERT([int],replace([Max_Off],'%',''))) Field Definitions: [Pro_PCT] [nvarchar](50) NULL, [Max_Off] [nvarchar](50) NULL, [IsExceeds] AS

how to add attribute for all subnodes of the xml in sql

泄露秘密 提交于 2021-02-19 08:39:22
问题 I have a xml like below in a variable @xml <ContentTemplate> <Tab Title="Lesson"> <Section Title="Lesson Opening" /> <Section Title="Lesson/Activity" /> </Tab> <Tab Title="Wrap Up and Assessment"> <Section Title="Lesson Closing" /> <Section Title="Tracking Progress/Daily Assessment" /> </Tab> <Tab Title="Differentiated Instruction"> <Section Title="Strategies - Keyword" /> <Section Title="Strategies – Text" /> <Section Title="Resources" /> <Section Title="Acceleration/Enrichment" /> </Tab>

Custom login page for Windows Authentication when using IIS

我们两清 提交于 2021-02-19 08:34:39
问题 I am developing an intranet website application in ASP.NET Core 2.0 and trying to use Windows Authentication in conjunction with IIS, and then check the user against the authorised users in a database before the user can continue. The issue is, that the default browser pop-up is not really what is desired. Ideally, I want to use a custom login/logout page with this method, but I don't think it's possible. Alternative routes I have seen, are turning Windows Auth off, turning Anonymous auth on

Custom login page for Windows Authentication when using IIS

时间秒杀一切 提交于 2021-02-19 08:34:07
问题 I am developing an intranet website application in ASP.NET Core 2.0 and trying to use Windows Authentication in conjunction with IIS, and then check the user against the authorised users in a database before the user can continue. The issue is, that the default browser pop-up is not really what is desired. Ideally, I want to use a custom login/logout page with this method, but I don't think it's possible. Alternative routes I have seen, are turning Windows Auth off, turning Anonymous auth on

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

Find min and max for subsets of consecutive rows - gaps and islands

半城伤御伤魂 提交于 2021-02-19 08:13:26
问题 Trying to build a query. The input is ordered by rownumber in column 'rn' starting with 1 for each unique value in 'name' and defining a given sequence of entries in 'act'. In column 'act' it holds two values in multiple occurence, >sleep< and >wake<. The goal is to find for each consecutive set of rows of one of those values the minimum and maximum value of startt and endd. This shall be the input: name act rn startt endd ---------- ---------- ------ ------ ------ jimmy sleep 1 1 3 jimmy

Access/SQL Server 2008 Join using Like not working

安稳与你 提交于 2021-02-19 08:04:56
问题 I apologize ahead of time because this question is in various forms many times on this site, but none of the solutions I have tried implementing seem to work properly, and I cannot find an answered question that gets me the right answer. I am working in access for a co-worker, though it will probably be in SQL in the future once he can get a server set up. I am trying to join two tables using Like, which is easy enough, except that it just is not working properly. First, an example from each