sql-server

SQL Server Merge Replication Problems

I have Merge replication setup on a CRM system. Sales reps data merges when they connect to the network (I think when SQL detects the notebooks are connected), and then they take the laptops away and merge again when they come back (there are about 6 laptops in total merging via 1 server). This system seems fine when initially setup, bu...

get output of last Process on SSAS cube

I have processed a SSAS cube. After it was done processing, I hit the close button - and then realized that I should have saved the output. I think SSAS stores the processing log as a text or XML file, but I do not know what folder to look into. Can someone direct me to retrieving processing logs? ...

Dynamic Datasource in SQL Server Stored Procudure

I have a SQL Server that houses Several Databases. I have a Main Database that holds several tables with entities and ID numbers. Then, each one of those entities has a correlating database (not a table, but database) with all of its information. For example, if the an entity in the MAIN database has an ID number of 1, there would be an ...

Tokens for SQL statement fill in blank instead of NULL making it crash...

I have a sql statement like this: DECLARE @MyVariable as varchar(50) SET @MyVariable = $(TokenValue) In this the $(TokenValue) will fill in a value from a form (ignore how it's doing it, it's not important, just that if there's a value in the field it relates to it'll get filled in there). If The field in the form was left blank howev...

View all ntext column text in SQL Server Management Studio for SQL CE database

I often want to do a "quick check" of the value of a large text column in SQL Server Management Studio (SSMS). The maximum number of characters that SSMS will let you view, in grid results mode, is 65535. (It is even less in text results mode.) Sometimes I need to see something beyond that range. Using SQL Server 2005 databases, I often ...

Concatenate row values T-SQL

I am trying to pull together some data for a report and need to concatenate the row values of one of the tables. Here is the basic table structure: Reviews ReviewID ReviewDate Reviewers ReviewerID ReviewID UserID Users UserID FName LName This is a M:M relationship. Each Review can have many Reviewers; eac...

Trying to initialize 2 values in 2 variables using 1 query, is it possible to do this. ?

SET @Password = ( SELECT UserPassword,IsLocked FROM [Authentication].[tblLogin] WHERE UserName=@UserName) i m trying to get both values userpassword and islocked in two variables to be used in same SP in next query. Is it possible or do i have to write two queries for this. Is it there a concept of arrays in sql server ...

SQL Server Delete on read

Is there an easy way in SQLServer touse data as READ_ONCE? What I mean is, can I set it to delete a row after it has selected it? ...

Full Text Search: Noise words are being searched for

Hi, I have a database in SQL Server 2008 with Full Text Search indexes. I have defined the Stopword 'al' in the Stoplist. However, when I search for any phrase with the keyword 'al', the word 'al' is still uesd in ranking. This might be related to the fact that I am breaking up search terms, and reconstructing them. I am then searching...

T-SQL Soundex/Difference to find duplicate rows

I have a legacy DB with: firstname, lastname, address1, address2, address3, address4, zipcode The data is scattered between the different columns with no consistency eg the actual zipcode could be in any column and there are plenty of typos. Is there a way I could use something like SOUNDEX / DIFFERENCE in a SP to loop through everythin...

Group events by temporal distance in SQL

In general, I need to associate (group) records which are created in similar time periods. If it helps, thinking of the example below as clickstream data where there is no sessionID and I need to build those sessions. I have the following dataset: UserId INT, EventId INT, DateCreated DATETIME, BlockId INT Assume the following data: ...

SQL Server EnumParameters Method on StoredProcedure object in SQL Server 2008 SQL-DMO

Hello all you wonderfully helpful people, What is the alternative to EnumParameters in SQL Server 2008? This MSDN article mentions that this method is going away, so what should be used instead? http://msdn.microsoft.com/en-us/library/ms133474%28SQL.90%29.aspx Here is the error we receive when attempting to use this method: Micros...

How do you best offload a database insert, so a web response is returned quicker?

Setup I have web service that takes its inputs through a REST interface. The REST call does not return any meaningful data, so whatever is passed in to the web service is just recorded in the database and that is it. It is an analytics service which my company is using internally to do some special processing on web requests that are ...

Best practice for a SQL Archiving Stored Procedure

I have a very large database (~100Gb) primarily consisting of two tables I want to reduce in size (both of which have approx. 50 million records). I have an archive DB set up on the same server with these two tables, using the same schema. I'm trying to determine the best conceptual way of going about removing the rows from the live db a...

How to format keywords in SQL Server Full Text Search

I have a sql function that accepts keywords and returns a full text search table. How do I format the keyword string when it contains multiple keywords? Do I need to splice the string and insert "AND"? (I am passing the keywords to the method through Linq TO SQL) Also, how do I best protect myself from sql injection here.? Are the de...

tips for optimizing a read-only sql database

I have a mid-sized SQL Server 2008 database that has actuarial data in it. All of the use cases for it are read-only queries. Are there any special optimizations I should consider given this scenario? Or should I just stick with the normal rules for optimizing a database? ...

How to select bottom most rows?

I can do SELECT TOP (200) ... but why not BOTTOM (200)? Well not to get into philosophy what I mean is, how can I do the equivalent of TOP (200) but in reverse (from the bottom, like you'd expect BOTTOM to do...)? ...

sql server authentication user

very basic question. sql server 2008, created new login and gave it sql authentication mode. checked status is enabled. Tried to connect to same server instance, login failed. What is going wrong? thanks for help in advance ...

How can I query the list of FULL table names in SQL server database

I have a need to iterate over all of the tables in my database. I am doing so with thsi query: SELECT so.name, so.* FROM sysobjects so WHERE so.xtype = 'U' This works fine for all of the tables in the 'dbo' schema, but it doesn't work for any other schemas. I want the output to be like this: Users.Address Users.TelephoneNumbers dbo...

Parse/Shred Huge Complex XML to SQL Server 2008 Database (30+ tables)

I read this already: http://stackoverflow.com/questions/61233/the-best-way-to-shred-xml-data-into-sql-server-database-columns and http://stackoverflow.com/questions/223376/looking-for-a-good-bulk-insert-xml-shredding-example-for-sql-2005. The differences of why I'm posting is that I'm using BizTalk 2009 and SQL 2008. I'm receiving ...