sql-server

In sql server - report server URL acces denied error

when trying to open report server url http://<>/Report server i am getting error / does not have enough permissions rsAcessdenied error. how to add domain account in reporting services to get all the privileges so that i can open the report server URL. ...

IN vs = in Where Clauses

I try to create standardized SQL scripts for use in my SSRS reports. If I wish to have a statement such as: Select * from mytable and use a SQL Variable (SSRS parameter) in the where clause, is there any speed advantage to using this: Where field = @MyField VS. Where field IN (@MyField) I know the second option supports both mu...

Why does SQL Server 2008 Express Management Studio change the password of a new login automatically?

I created a new login using Express Management Studio and SQL Server authentication. On create, the password changes to some long format automatically and I am not able to connect using the newly created user with the password I have set. What do I have to do to let it use the same password that I set and not tamper with it ? ...

Only inserting a row if it's not already there

Hello, I had always used something similar to the following to achieve it: INSERT INTO TheTable SELECT @primaryKey, @value1, @value2 WHERE NOT EXISTS (SELECT NULL FROM TheTable WHERE PrimaryKey = @primaryKey) ...but once under load, a primary key violation occurred. This is the onl...

Migrating data from MSSQL to MySQL

I have a few tables in SQL Server Express that contain data with high characters - ex: Häagen-Dazs I've exported SQL inserts and when I run in MySQL they fail on these characters. SQL Express doesn't have DTS so I can't do an ODBC transformation. I've used FileMaker Pro's external table functionality but the characters show up as odd c...

Best way to design this database scenerio?

Requirement is to store attachments for different entity types. Say we have 3 entity types Company , Department and Employee. Each can have multiple attachments (documents). Which is the best way to handle this? Solution 1: Company table CompanyId Dept table DeptId Employee table EmployeeId AttchmentType table TypeId Ty...

Problem updating table using IN clause with huge list of ids

Hi I am having a problem when trying to update a table using an IN clause, I have a big list of clients that should be updated 4500+. Update table set columnA = 'value' where ID in ( biglistofids ) //biglistofids > 4500 ids I am getting this error "String or binary data would be truncated." I tried the same script with fewer ids le...

Searching lists, ranges

I have an ASP.NET application which needs to search a VARCHAR(20) column using lists and ranges. In other words, the input could be something like: ABC,444,CD-EF,90-BA,HIJ and the result needs to be the equivalent of: SELECT * FROM table WHERE Col1 = 'ABC' OR Col1 = '444' OR Col1 BETWEEN 'CD' AND 'EF' OR Col1 BETWEEN '90' AN...

Combine XML from T-SQL

Hi All, I have two separate tables TVs and Receivers that I am using the FOR XML PATH commands to build XML off of. My issue is that I want to combine the output of my TV XML Build with my Receiver XML Build to create one XML output. So I would have something like this(Which allows me to keep the TVs and Receivers Tags Separate within...

Powershell -contains/-notcontains - having trouble with an array result from SQLServer

I am using Invoke-SQLCmd to get a list of items that I want to process. In that list may be an item that indicates that the entire list needs to be bypassed. I have tried to figure out how to use the -contains and -notcontains operator but I am not having any luck. This would be the pseudo code: $dont_process = "dont process" $list = In...

Traversing multiple CSV in SQL

Hello, I have a SQL Server 2008 database. This database has a stored procedure that will update several records. The ids of these records are stored in a parameter that is passed in via a comma-delimited string. The property values associated with each of these ids are passed in via two other comma-delimited strings. It is assumed that ...

Scripts for moving schema changes from development database to production database

I'm trying to head this one off at the pass. I've got two database servers (DEV and PRD) and I have my database on the DEV server. I am looking to deploy v1 of my application to PRD server. The question is this: Say in two months, I am ready to ship v1.1 of my application, which introduces two new VIEWS, six new fields (three fields in...

Dynamic Linked Server Query

Is it possible to construct a dynamic query to for a linked server (and if so how)? For example: @linkedServer varchar(50) @var1 varchar(10) @var2 varchar(10) select * from openquery(@linkedServer, 'select c1,c2 from t1 where p1 = @var1 and p2= @var2...

how to handle db schema updates when using schemabinding and updating often

I'm using a MS SQL Server db and use plenty of views (for use with an O/R mapper). A little annoyance is that I'd like to use schema binding update with scripts (to deploy on servers and put in a source control system) but run into the issue that whenever I want to e.g. add a column to a table, I have to first drop all views that re...

help with t-sql linked server

Hi Based on the 2 databases below: Database_A on Server_1 Database_B on Server_2 I have created a linked server to Database_B on Server_1 instance by name 'LS_B'. I have a huge script file which basically creates required tables, functions, views, and stored procs on Database_A. These functions, views and stored procs in turn ref...

Memory leak with .NET SqlConnection and DataSet

I'm having a memory leak issue in a service program that runs SQL scripts and dumps the results out to files. After running queries that produce many result rows, the memory usage of the process goes up by 50+ MB each time and doesn't come down. Here is the code that opens the connection and retrieves the results: using (var conn = new...

SQL Server composite key experience

I want to make a composite key (well that's the idea but I'm open to other suggestions) on a Documents table. It would consist of two columns, year (2010,...) and an ID, which would be autoincrementing but it should restart itself every year. So keys like these 2010-1, 2010-2, ..., 2011-1, 2011-2, ... and, preferrably those keys should ...

SQL: Group By on Consecutive Records

A slightly tricky SQL question (we are running SQL server 2000). I have the following table, StoreCount - WeekEndDate StoreCount 2010-07-25 359 2010-07-18 359 2010-07-11 358 2010-07-04 358 2010-06-27 358 2010-06-20 358 2010-06-13 358 2010-06-06 359 2010-05-30 360 2010-05-23 360 2010-05-16 ...

Are there any major pitfalls using PostgreSQL as a replacement for SqlSever

I'm just looking at the possibility of using postgresql as an alternative to sqlserver for a .NET web app. (as a cloud hosted sqlserver costs an arm and a leg once the size of your data is over 20GB or so) so really looking for something with reasonably good performance that can hold a lot of data. However, I'm not entirely sure wha...

There has to be a better way to do localized database fields

So far there've been several questions regarding this, and they've all come down to the same answer: one table for the language-neutral data, 1-* to a table with the translations and an indexed language ID field. This has several problems: Twice as much CRUD. Need for Ajax CRUD if you want a decently friendly web UI. More than twice t...