sql-server-2008-r2

SQL Pivot Table Subtotal Syntax error

柔情痞子 提交于 2019-12-25 04:28:22
问题 Hoping someone can help me. I was able to put together this SQL script but it coming back with minor errors here and there. I'be been trying to debug for over a week now. Please help. the first error message is "Incorrect syntax near ')'." If you fixe that it keeps on throwing more out so I'm thinking I'm not coding this correctly. I am unable to save changes that do work. it tell me the save request was aborted. Working with SQL Server 2008 r2 SELECT PublicationID AS PubID, (PubNum + '- ' +

Full Text Catalog is destroyed after changes in table

守給你的承諾、 提交于 2019-12-25 04:27:26
问题 I'm facing a strange problem: Everytime I make changes in tables (e.g. adding a column, altering a column's datatype, renaming a column, etc.) my full text catalog is being destroyed the moment I press "Save" in the SSMS. After that, SSMS's properties dialog of the full text catalog shows a catalog size of 0 MB and an item count of 0. The only option I have after this is to rebuild the catalog. Has anyone experienced the same or a similiar problem? Some additional info: SQL Server 2008 R2,

concatenate values of one column to single text

北城余情 提交于 2019-12-25 04:15:26
问题 my Column is like this: col1 Mary Jack John and i need to get something like this: Mary,Jack,John I did it by using "For XML PATH", but the problem is that segment not work in SQL server view, is there other way to get concatenation of one column? 回答1: try using SQL COALESCE experession to convert your column values into a comma separated string. here's what you need to do. DECLARE @test TABLE ( SampleCol varchar(50) ) INSERT INTO @Test VALUES ('Test') INSERT INTO @Test VALUES ('Test 1')

intermittent System.Data.Entity.Infrastructure.DbUpdateConcurrencyException

天大地大妈咪最大 提交于 2019-12-25 04:11:48
问题 The following code is causing an intermittent exception: public int UnblockJob(int jobId) { using (var connect = MakeConnect()) { var tag = connect.JobTag.SingleOrDefault(jt => jt.JobId == jobId && jt.Name == Metrics.TagNameItemBlockCaller); if (tag == null) { return 0; } connect.JobTag.Remove(tag); return connect.SaveChanges(); } } How can I correct or troubleshoot it? 回答1: From the documentation for DbUpdateConcurrencyException: Exception thrown by DbContext when it was expected that

The conversion of a calender extender selection date format to a DateTime data type resulted in an out-of-range value

烈酒焚心 提交于 2019-12-25 03:59:16
问题 I am trying to fetch number of records for a particular date by feeding the calender extender selection into a textbox and fetching the corresponding count from the database. The datatype of the checkdate column is DateTime. We tried : protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { string result = "select count(*) from <TableName> where Checkdate= GETDATE() and sub_code=@sub_code"; SqlCommand cmd = new SqlCommand(result, connection); connection.Open(); Label3

Full-text Search Using Freetexttable Failing on Noise Words - SQL Server 2008 R2 Transform Noise Words not working

喜欢而已 提交于 2019-12-25 03:56:57
问题 I am running a full-text search for my site using SQL Server 2008 R2 and freetexttable. I am getting this error when a stop word is entered: Informational: The full-text search condition contained noise word(s). So I did what everyone said to do and turned on the Transform Noise Words so the stop/noise words are ignored and the query can continue. But this changed nothing: sp_configure 'show advanced options', 1; RECONFIGURE; GO sp_configure 'transform noise words', 1; RECONFIGURE; GO I still

Create automated installer of VB.Net program + SQL Server & script to create the DB & user

可紊 提交于 2019-12-25 03:32:43
问题 I'm in the final stages of building a Vb.Net WinForms app in a client/server scenario (forms over data stored in SQL Server) In this particular project we won't be the ones deploying the software so we're looking for a way to automated the Database part of the setup as much as possible. The client application is being deployed with ClickOnce, so that's sorted. As for the Database setup, can you advise on the best way to automate this? Typically the deployment would go like (this is what we'd

SQL Server 2008 R2: Recursive query

萝らか妹 提交于 2019-12-25 03:12:17
问题 This is the follow up question of : Prepare a recursive query I have the table with the two columns namely cola and colb as shown below: Table : Test create table Test ( cola int, colb int ); Records I have entered are: Cola Colb ------------ 1 2 1 3 1 4 2 5 2 6 2 3 3 2 3 4 3 7 3 10 10 11 11 12 11 13 11 14 12 15 13 16 14 99 15 88 16 77 Note : Now I want to show the only records who are connected with value I have pass. For example If I pass the value as 1 then it should display me the

How to return the value that exists in SQL Server XPath?

折月煮酒 提交于 2019-12-25 03:01:40
问题 There is a question somewhere on Stackoverflow, although i cannot find it now, that reminded the poster that .value does not return the value that .exist s. That is because .value is always written as asking for the [1] item, where .exist looks everywhere. Example Given a hypothetical xml document containing two customers: <Customer> <Name>Ian Boyd</Name> <IDInfo> <IDType>1</IDType> </IDInfo> </Customer> <Customer> <Name>Kirsten</Name> <IDInfo> <IDType>3</IDType> <IDOtherDescription>Firearms

How to return the value that exists in SQL Server XPath?

若如初见. 提交于 2019-12-25 03:01:00
问题 There is a question somewhere on Stackoverflow, although i cannot find it now, that reminded the poster that .value does not return the value that .exist s. That is because .value is always written as asking for the [1] item, where .exist looks everywhere. Example Given a hypothetical xml document containing two customers: <Customer> <Name>Ian Boyd</Name> <IDInfo> <IDType>1</IDType> </IDInfo> </Customer> <Customer> <Name>Kirsten</Name> <IDInfo> <IDType>3</IDType> <IDOtherDescription>Firearms