sql-server

Error in Visual Studio 2008 with SSRS 2005 report projects

Has anyone found a good workaound for opening or editing an SSRS 2005 report project with Visual Studio 2008 yet? Will the SQL server 2008 tools be the migration path for these report projects in the future? I really dont want to have to keep VS2005 installed forever just to update SSRS reports. After an upgrade to VS2008 an existing ...

Entity Framework - Mapping doesn't map for stored procedure?

I have a stored procedure that search a view using full text. I'm trying to map the results to an existing Entity (Sales), where I mapped the column MivType to SaleType (as it makes more sense, and I want to keep db names away from my web site). The stored procedure is mapped to a Function Import, and I've defined its ReturnType to Sales...

SQL Server 2005 + JavaEE application on one computer in production

We have project with a server witch have about 3000 requests at day from client. 30-40 on-line users. And smth about 30-40Gb data increase per year. And system should be on-line 24x7. Where can we locate the SQL server better? On one computer with JavaEE container or on standalone computer? What pros and cons on this ways? ...

Doing an IF in SQL WHERE

I want to do this SELECT * FROM sales_order_header WHERE order_reference LIKE @order_reference + '%' AND ((@booked_in IS NULL) OR ( booked_in = @booked_in)) AND ((@depot_assigned IS NULL) OR ( IF @depot_assigned = 'Y' depot_code <> ' ' ELSE depot_code = ' ') ) I'm sure you can all guess the OR ( IF @depot_assigned etc ...

How to do locking in SQL Server like MYSQL

Hi all, I'm converting a webapp from mysql to SQL Server. Now I want to convert the following code (this is a simplified version): LOCK TABLES media WRITE, deleted WRITE; INSERT INTO deleted (stuff) SELECT stuff FROM media WHERE id=1 OR id=2; DELETE FROM media WHERE id=1 OR id=2; UNLOCK TABLES; Because I'm copying stuff which is goin...

Clone entire database with a SP

Hi guys, I'm trying to find out if this is possible, but so far I haven't found out any good solutions. What I would like to achieve is write a stored procedure that can clone a database but without the stored data. That means all tables, views, constraints, keys and indexes should be included but without any data. Can it be done? ...

Compare time part of DateTime data type in SQL Server 2005

How can I compare only the time portion of a DateTime data type in SQL Server 2005. For example, I want to get all records in which 'MyDate' field is after a specific time. The following example is a very long and probably not fast way of doing this. I want all date in wich time is greater than 12:30:50.400 SELECT * FROM Table1 WHERE ...

Database creation script - external parameters/settings

Question Summary: Is there a better method than the one posted below to implement the database-creation stage of an automated deployment? Background/Requirements: I am in the process of attempting to develop a coherent database version control process using an approach similar to this one. This question is specifically about the bas...

SSRS Report Viewer in MVC app (but web form) gives me the following error

Hello, I'm getting the following error for a web form page in an MVC application. I'm trying to set the parameters programmatically (so the report has an ID/year parameters and I set both with valid values), and I get the error: The parameter '{0}' cannot be an empty string. Parameter name: cookie.Domain Any idea why I am getting thi...

SQL Server 2000 Reverse Engineer Tool

Is there any free tool that I can use to reverse engineer databases in SQL server 2000? Thanks, ...

Is there a more efficient way to handle these replace calls

I'm querying across two dbs separated by a legacy application. When the app encounters characters like, 'ü', '’', 'ó' they are replaced by a '?'. So to match messages, I've been using a bunch of 'replace' calls like so: (replace(replace(replace(replace(replace(replace(lower(substring([Content],1,153)) , '’', '?'),'ü','?'),'ó','?'), 'é'...

SSRS Report in MVC APP (web form page) and ViewState

Hello, I am not able to use the SSRS report viewer in a web form page within a MVC application. It all works great, but when the control goes to render I always get the error within the control: ASP.NET ViewState has been disabled. The Report Viewer control requires that ViewState be enabled. I set EnableViewState to true on the con...

Searching whether data in one table exists in another table using full text search SQL Server 2008

Hi, I am trying to find out whether I can do the following using joins instead of looping through each record. Table1 ------------ LastName FirstName Table2 ------------- UniqueId LastName (full text indexed) FirstName (full text indexed) for each record in table1, I am trying to find out if there are any matching records in table...

OFAC compliance queries using sql server 2008

Has any one implemented OFAC compliance checking using Sql server 2008. If so, can you please give some advice on how you did it? Thanks, sridhar. ...

Indexes for inner joins with where clause

If I had the following query: select some cols from tbl_a INNER JOIN tbl_b ON tbl_a.orderNumber = tbl_b.orderNumber where tlb_b.status = 'XX' Assuming both tables have clustered indexes on order number only, would it be better from a performance perspective to extend the clustered index on table b to include the status column r...

First time installation / deployment on clients machine

Hi, We have a silverlight ASP .NET web application which needs to be deployed on client's server along with Sql Server database. Once they deploy on their server, many workstation can access it and run silverlight client. I was thinking to create a small deployment project, add necessary script files to the resources, and create an msi...

Clone a row with a primary key in SQL?

Hello, I am attempting to make some cross-DB(SQL Server and PostgreSQL) compatible SQL. What I am needing to do is clone a row. It is preferable to do it locally on the SQL server without having to pull the entire row down to our client and reinsert it. Also, we prefer to not have to create a new SQL query from scratch putting in column ...

Permissions issue in SSMS: "The SELECT permission was denied on the object 'extended_properties', database 'mssqlsystem_resource', ... Error 229)"

Here’s the simplest repro case possible. Create a brand new database. (I'm using SQL 2005.) Create a login, a SQL user, and a table in the new database (see sample code below). Launch SSMS and open Object Explorer, logging in as the newly-created user. Attempt to open the "Tables" folder in the Object Explorer. The Problem Fails wit...

Update SQL Server 2005 view with new database name?

I have approximately 100 SQL views that are a variation of this: select * from RTC.dbo.MyTable ...now I find I need to change the name of the RTC table to something else. Rather than edit one view at a time, is there a way to script out all their drop/create statements to a text file so that I can do a global replacement? ...

CTE SQL query get full paths

Hi, I have got simple query WITH conn_cte ( ParentCategoryId, CategoryId, IdsPath ) AS ( SELECT ParentCategoryId ,CategoryId ,CAST(ParentCategoryId AS varchar(1000)) FROM Ind_CategoriesConnections WHERE ParentCategoryId = 0 UNION ALL S...