sql-server

Prepare Database For SQL Server Clustering

we are planning to implement sql server 2005 cluster in next few months. i wanted to know what steps / precautions need to be taken as a database developer when trying to achieve this? do we need to change any ado.net code (in front end) / stored procs etc etc? are there any best practices to be followed? reason i am asking this questio...

Using SQl Server CE; Possible to Insert Only If Not Exists and Delete if Exists?

I have a One Field Table in SQL CE which I need a SQL Statement for. The objective is to Delete the record if it already exists and insert the record if it does not exist. Is the possible with SQL CE? INSERT INTO Source_Table SELECT 'myvalue' AS Expr1 WHERE (NOT EXISTS (SELECT Source_Data FR...

What's the impact of 'select *' from a view on building the execution plan?

I've heard using 'select *' will add to the time SQL Server takes to build the query execution plan as it has to find out which columns are present on the referenced tables. Does the same apply for a query based on a view instead of a table? ...

question on execute ssis package

I developed ssis project on my local machine, extracting data from mysql db to sql server 2008. Everything works fine. Now i move the package, the .dtsx file, to the server which is a 64bit window 2008 box, it stops working. The problem is that package default to sqlserver driver instead of mysql drive. I have to move the whole project t...

SQL: 3 self-joins and then join them together

I have 2 tables to join in a specific way. I think my query is right, but not sure. select t1.userID, t3.Answer Unit, t5.Answer Demo FROM table1 t1 inner join (select * from table2) t3 ON t1.userID = t3.userID inner join (select * from table2) t5 ON t1.userID = t5.userID where NOT EXISTS (SELECT * FROM ...

primary filegroup full

I discovered an error in a log file while troubleshooting another issue on our SQL 2000 server. I am seeing primary filegroup is full. The MDF and LDF files are in the default location on the system partition, on an NTFS drive. The MDF file is 1962MB in size. Some posts have indicated that the size can't excede 2GB. I ran a db shrin...

full-text index returns incorrect results

I created a full-text index on a text column and subsequent contains queries return results that don't include the search term. An example query is: SELECT TOP 10 serial_no,writer_id,myField,assignment_type,subdate,title FROM writing WHERE contains(myField,'"take it once"'); ...

What is a SQL Server module?

I just came across the system view sys.sql_modules today. What is a module versus a DB object? The view returns, most prominently, a column containing the definition text, as returned by sys.syscomments. ...

What is the fastest way to get varbinary data from SQL Server into a C# Byte array?

The title speaks for itself. I'm dealing with files/data near 2MB in size. ...

How do I combine these two SQL statements into one, in a manner compatible with both MSSQL 2000 and 2005?

My end goal is to accomplish something like: CREATE FOREIGN KEY IF NOT EXISTS FOREIGN KEY Since that statement doesn't appear to exist, I'm attempting to sort of kludge it together. I have a statement that will return the FK name if it exists: SELECT f.name AS ForeignKey FROM sys.foreign_keys AS f WHERE OBJECT_NAME(f.parent_object_...

Best way to literal phrase search a text column in SQL Server

I thought full-text search would let me do exact phrase searching in a more optimized way than a LIKE predicate, but I'm reading that it doesn't do that exactly. Is "LIKE" the most efficient way to search thousands of rows of TEXT fields in a table for a literal string? It's got to be exact matching... ...

Migrating Database SQL Server to Sybase

Hey folks, I'm migrating a database from MS-SQL to SyBase 15.2, please propose any tools which can assist me on this task. also please post your experience with SyBase, especially the Replicator. Many thanks ! ...

Table design

I was wondering is this a good design, assuming the tables as follows ADDRESS(id, address, city_fk, stateFK, countryFK), CITY(id, name, stateFK, countryFK), STATE(id, name, countryFK), COUNTRY(id, name) Notice how country fk is repeated in 3 tables? and state fk repeated in 2 tables? Can anyone tell me if this is a good design? If s...

SQL Server vs. Access insert performance, in particular when using GUID

I'm interested to know how I could improve the performance of SQL Server when using sequential GUID when using Access 2007 as a front end to SQL Server 2008 (please note it's the only context I'm interested in). I have made some tests (and gotten some fairly surprising results, in particular from SQL Server when using sequential GUID: t...

uniqueidentifier in Sql Server database - how to generate in Java environment?

I have a database table that uses Sql Server 2005's uniqueidentifier column. I know how to create GUIDs in C#... string newid = System.Guid.NewGuid().ToString(); However, the application that is inserting into this database is running Java. Is there a way to generate Sql-Server-compatible GUIDs using Java code? (NOTE: generating th...

Getting SQL Server Execution Plan through SMO?

I know I can get the execution plan in Management Studio in XML format using "SET showplan_xml ON". Is there a way to get the same information through .NET code? ...

SQL Server 2008 Query is slow in production but fast in development

I have a query that runs in about 2-4 minutes on production but runs in a couple of seconds on development. Both of these databases are on the same exact server. (no lectures about dev and production, production is really still in development). I mean, I can just open two query windows and get the two different results consistently. I ...

A Simple Sql Select Query

I know I am sounding dumb but I really need help on this. I have a Table (let's say Meeting) which Contains a column Participants. The Participants dataType is varchar(Max) and it stores Participant's Ids in comma separated form like 1,2. Now my problem is I am passing a parameter called @ParticipantsID in my Stored Procedure and want ...

What privileges are required to store an SSIS package in SQL Server 2008

Hi, I want create SSIS package as a DB User. Also I want to store it to SQL Server not in file system. The DB user only have a db_owner privilege on a particular database. What least privileges are required to create SSIS. Already I have assigned the following grant execute on dbo.sp_ssis_checkexists to test grant execute on dbo.sp_...

Integrated Windows Authentication with IIS, Firefox and SQL Server

Hi, I have a web site running on IIS on my localhost. This web site has directory security set to only allow Integrated Windows Authentication. It is part of an intranet and needs to authenticate by our domain accounts. I then connect to SQL Server with Integrated Security = SSPI in the connection string. This works fine with Microsof...