sql-server

What characters are disallowed in an ftp Delete command?

I am ftp'ing files from an external server, then deleting them on the external server, and one file failed because there was a space in the filename. I changed my ftp delete command to have quotes around the filename. ftpStream.WriteLine("delete """ & FileToDelete & """") But, are there other characters that a user might use in their...

Optimizing Importing of Data to SQL Server 2005 with C#

I have a table that has about 1/2 million records in it. Each month we get about 1/2 million more records to import. These are currently shoved into another table in the DB, but will eventually be loaded directly from a txt file. For each of these new records, I have to determine if we have that record already, and if we don't, then i...

LINQ to SQL

I am finishing off a C# ASP.NET program that allows the user to build their own computer by selecting hardware components such as memory, cpu, etc from a drop down lists. The SQL datatable has 3 columns; ComputerID, Attribute and Value. The computerID is an ID that corresponds to a certain computer in my main datatable of products, the A...

SQL Server Enterprise Manager 2005 - stored procedures not showing up

When using SQL Server Management Studio from SQL Server 2005, I can connect to an instance of SQL Server 2000... but none of the stored procedures show up. Is there some trick to allow SQL Server Enterprise Manager 2005 to properly talk to SQL Server 2000 databases? ...

How to simplify this Sql query

The Table - Query has 2 columns (functionId, depFunctionId) I want all values that are either in functionid or in depfunctionid I am using this: select distinct depfunctionid from Query union select distinct functionid from Query How to do it better? ...

SQL Server Database Management with Continuous Integration

Let's say we have a continuous integration server. When I check in, the post-hook pulls the latest code, runs the tests, packages everything. What is the best way to also automate the database changes? Ideally, I'd build an installer that could either build a database from scratch or update an existing one using some automated syncing m...

What to use for SQL Server instead of "Key"?

Hi! I have a script of MySQL queries that I use and that work. I'm trying to execute the same queries in Microsoft SQL server and there's one thing I don't understand. MySql uses "key" to define a key made up of different fields. What is the way to do the same thing in SQL Server? Thanks! -Adeena ...

SQL Server "AFTER INSERT" trigger doesn't see the just-inserted row

Consider this trigger: ALTER TRIGGER myTrigger ON someTable AFTER INSERT AS BEGIN DELETE FROM someTable WHERE ISNUMERIC(someField) = 1 END I've got a table, someTable, and I'm trying to prevent people from inserting bad records. For the purpose of this question, a bad record has a field "someField" that is all numer...

MySQL versus SQL Server Express Performance Comparison

I have a somewhat complex query with roughly 100K rows. The query runs in 13 seconds in SQL Server Express (run on my dev box) The same query with the same indexing and tables takes over 15+ minutes to run on MySQL 5.1 (run on my production box - much more powerful and tested with 100% resources) And sometimes the query crashes the ma...

Left join and Left outer join in SQL Server

What is the difference between left join and left outer join? ...

Divide by zero error in stored procedure

Hi i executed the following stored procedure in .net web application. Then run the application. I got this error " Divide By zero error " Stored procedure: CREATE procedure Details(@Stringtext varchar(8000),@SearchStringtext varchar(100)) as begin SELECT ({fn LENGTH(@Stringtext)}- {fn LENGTH({fn REPLACE(@Stringtext, @SearchStringtext,...

Troubleshooting VS C#/SQL Server Compact setup - "event log file full" message

I'm trying to develop a little C# application (with MS Visual Express and SQL Server) and am having an issue trying to figure out the error dialog that pops up: "the event log file is full" I'm following these instructions: http://msdn.microsoft.com/en-us/library/aa983322.aspx In MS Visual C#, I have the "Database Explorer" window ope...

MSSQL Database Cleanup - How do you find unused objects (Tables, Views, Procs, Functions)

Lets say you have inherited a MS SQL 2000 or 2005 database, and you know that some of the Tables, Views, Procs, and Functions are not actually used in the final product. Is there some kind of internal logging or another mechanism that could tell me what objects are NOT being called? or have only been called a few times versus thousand...

What are the limitations to SQL Server Compact? (Or - how does one choose a database to use on MS platforms?)

The application I want to build using MS Visual C# Express (I'm willing to upgrade to Standard if that becomes required) that needs a database. I was all psyched about the SQL Server Compact - because I don't want the folks who would be installing my application on their computers to have to install the whole of SQL Server or something ...

Stop LINQ to SQL from executing select statements after insert

I'm using LINQ to SQL to update my database. I'm inserting a lot of records, and when I call SubmitChanges(), LINQ to SQL executes an insert and a select statement for each object. I don't really care to update my objects after they are inserted into the database. Do you know I can prevent LINQ to SQL from issuing the select statement...

Internationalization in the database

Do you guys think internationalization should only done at the code level or should it be done in the database as well. Are there any design patterns or accepted practices for internationalizing databases? If you think it's a code problem then do you just use Resource files to look up a key returned from the database? Thanks ...

How to test for multiple row actions in a SQL Server trigger?

My kindergarten SQL Server taught me that a trigger may be fired with multiple rows in the inserted and deleted pseudo tables. I mostly write my trigger code with this in mind, often resulting in some cursor based cludge. Now I'm really only able to test them firing for a single row at a time. How can I generate a multirow trigger and wi...

SQL 2005 Query Help

I have table with 50 entries (users with such details like Name Surname Location etc) I want to create a query that give me users from row 1 to row 10. Then another query that give me users from 11 to 20 and so on. Is there any way how to do that? Thanks ...

Best way to keep GUI updated when the underlying SQL view data changes?

Let's say you have a form with a component that displays data from a view on an SQL server. The component would be something like a ListView or DataGrid - basically something that can display the data in a 2D grid format. Another application changes the data that the SQL view describes, and does this regularly but at undefined intervals....

How to change the data type of a column with query?

I have a column which has a datatype : datetime. But now i want to convert it to datatype varchar. Can i alter the datatype without droppping the column? If yes, then please explain how? ...