sql-server

VB6 SQL 2005 Database Index Question

I have a VB app that accesses a sql database. I think it’s running slow, and I thought maybe I didn’t have the tables propery indexed. I was wondering how you would create the indexes? Here’s the situation. My main loop is Select * from Docrec Order by YearFiled,DocNumb Inside this loop I have two others databases hits. Select *...

SQL Query - Copy Values in Same Table

So I have a table that looks like this: ProjectID TaskID Date 000 001 10/28/09 000 002 12/1/09 000 003 02/24/10 001 001 04/14/10 001 002 07/5/10 001 003 02/24/11 002 001 06/07/10 002 002 07/7/10 002 ...

CallableStatement setString - Unsupported character(s)?

I have a Java application decoding a UTF-8 encoded String received over the wire and saving it to a varchar column in my database (SQL Server 2000). I am saving the record using JDBC's CallableStatement (calling the setString method to set the parameter for this column). The problem I'm seeing is that a particular String has been writt...

Adding a Column Programmatically to a SQL Server database

I've taken over an ASP.NET application that needs to be re-written. The core functionality of this application that I need to replicate modifies a SQL Server database that is accessed via ODBC from third party software. The third-party application creates files that represent printer labels, generated by a user. These label files dire...

SQL Conditional on Bit

Why does this.. DECLARE @SkyBlue Bit SET @SkyBlue = 1 IF @SkyBlue Select 'the sky is blue!' ELSE Select 'the sky is not blue!' Produce this "An expression of non-boolean type specified in a context where a condition is expected, near 'Select'." And is there a Boolean type in SQL2008? ...

How do you reference a field in the Embedded Code of an SSRS report.

Hello, Is there a proper way to reference the fields of a ssrs report from the embedded code of an ssrs report? When I try to use Fields!Program.Value I get the following error -- There is an error on line 3 of custom code: [BC30469] Reference to a non-shared member requires an object reference. Upon googling I found you could re...

Can you reference the textboxes on an ssrs report from embedded code

Hello, Is it possible to reference a textbox from the embedded code of a ssrs report. I would like to show or hide the textbox based on a condition. Thanks. Seth ...

SQL Server Database - Hidden Fields?!

Hello! I'm implementing CRUD on my silverlight application, however I don't want to implement the Delete functionality in the traditional way, instead I'd like to set the data to be hidden instead inside the database. Does anyone know of a way of doing this with an SQL Server Database? Help greatly appreciated. ...

Passing Parameters to a Stored Procedure from Intergration Services Package

Is it possible to pass the parameters of a stored procedure, when the stored procedure is being executed from an Integration Service Package. Ideally I would like the value of a variable defined inside a SSIS package to be passed as parameter to the stored procedure. Is it possible, if so how? ...

Creating SQL UPDATE statements on the fly

I am in the midst of updating data in multiple tables. Currently I have a table that has one field, "sources", that is just a list of all tables that include the field "itemid". I also have a table that has 2 fields, "itemid" and "olditemid". In TSQL, I would like to iterate through the sources and create the update statements on the ...

smo doesnot display installed instances in w2k8 sql2k8 cluster????

Hi I have cretaed an application via COM interoperability(using SMO and created a dll consume it in c++) which retrieves the local instances of sqlserver(basically try for network instances and from that trace out for local to make it as work for remote discovery of sqlinstances). it is worked in all cases except win2k8sql2k8 cluster i...

MAMP: Adding ODBC or SQL Server support

I need to talk to a remote SQL Server 2000 database. I use MAMP locally and I would like to continue using it. However, I'm lost as to what I need to do to add support for talking to this database from PHP. It looks like either the ODBC or SQL Server functions in PHP will work, but those modules aren't installed by default. Can someo...

Connecting to MS SQL Server 2005 from Mac using Ruby, ODBC and FreeTDS

I'm having trouble connecting to a SQL Server 2005 install from this very simple Ruby app: #!/usr/bin/env ruby require 'rubygems' require 'sequel' Sequel.odbc('dev04')['select top 1 * from users'].all The dev04 DSN points to my odbc.ini file entry: [dev04] Driver = FreeTDS Description = ODBC connection via FreeTDS Trace =...

Alternative to running DB Lookup functoid through a loop?

I'm really not sure how to phrase this, so here's my best shot- I have a table which stores values by a 'TypeId' and the actual value. The 'TypeId' maps to a row in a lookup table which houses the actual plain-text description. When inserting data into my Database via BizTalk Server 2009, I need to perform a lookup on each value provi...

How to delete records in SQL 2005 keeping transaction logs in check

I am running the following stored procedure to delete large number of records. I understand that the DELETE statement writes to the transaction log and deleting many rows will make the log grow. I have looked into other options of creating tables and inserting records to keep and then Truncating the source, this method will not work for...

When can I host IIS and SQL Server on the same machine?

I've read that it's unwise to install SQL Server and IIS on the same machine, but I haven't seen any evidence for that. Has anybody tried this, and if so, what were the results? At what point is it necessary to separate them? Is any tuning necessary? I'm concerned specifically with IIS7 and SQL Server 2008. If somebody can provide numb...

SQL Filter criteria in join criteria or where clause which is more efficient

I have a relatively simple query joining two tables. The "Where" criteria can be expressed either in the join criteria or as a where clause. I'm wondering which is more efficient. Query is to find max sales for a salesman from the beginning of time until they were promoted. Case 1 select salesman.salesmanid, max(sales.quantity) from...

Set Variable Values

I'm sure this is something simple, but I can't seem to figure it out. Why doesn't this code work? DECLARE @FirstSaturday DATETIME DECLARE @ENDDATE DATETIME SELECT @FirstSaturday = min(RED1.DATE) FROM REDFRIDAYDATES..TBLREDFRIDAYALLDATES RED1 WHERE Period = 9 AND year = 2009 SELECT CASE WHEN getdate() < @FirstSaturday THEN set @ENDD...

Getting "SQLExpress database file auto-creation error" for ASP.NET site that uses AspNetSqlMembershipProvider, but connection string is to SQL Server 2005

Folks, I have an ASP.NET v2.0 website (not web application) where the root directory is public, but the "Admin" subdirectory requires authentication. Everything about the setup is very generic - I used a connection string defined in the root web.config, and the standard AspNetSqlMembershipProvider provider, and I'm using the ASP.NET Lo...

SQL Server: How to change name in a view?

I am using Visual Studio 2008 and SQL Server 2008 Express. How can I change the name of the view? I can change tables' names, but I can't change the view name. Any suggestion? Thank you, Fabio Milheiro ...