sql-server

Is there a SQL Server error numbers C# wrapper anyone knows of?

I really want to do something useful when a PK violation occurs but I hate trapping error numbers... they just don't read right without comments (they're certainly not self documenting). I know I can find all the potential error numbers at SQL Server books online but I really want to be able to pass the error number to some helper class...

specify content type of an attachment in sql server sp_send_dbmail

How can I specify the content type of an attachment when sending emails using sp_send_dbmail? The content type is specified as application/octet-stream for Zip, PDF files. But I need to change it to application/zip, application/pdf. The "file_attachments" parameter takes absolute paths of the attachments. Can not find a place to specify...

COM+ Applications returns an error when when I try to add a new application

Error message returned 'An error occurred while processing the last operation. Error code 800401154 - Class not registered The event log may contain additional troubleshooting information.' The other thing is, the is a red arrow icon displayed over My Computer (Component Servers -> Computers -> My Computer). I have searched everywhere ...

SQL Server stored procedures - update column based on variable name..?

Hi, I have a data driven site with many stored procedures. What I want to eventually be able to do is to say something like: For Each @variable in sproc inputs UPDATE @TableName SET @variable.toString = @variable Next I would like it to be able to accept any number of arguments. It will basically loop through all of the inputs a...

SQL Server join and wildcards

I want to get the results of a left join between two tables, with both having a column of the same name, the column on which I join. The following query is seen as valid by the import/export wizard in SQL Server, but it always gives an error. I have some more conditions, so the size wouldn't be too much. We're using SQL Server 2000 iirc ...

DBExpress connecting SQL 2008 at runtime with Delphi 2009

Hi, I'm trying to connect at runtime with SQL Server 2008 with Delphi 2009 using DBExpress, it it's not working. When I set all the properties at design time, it works great, but at RunTime, I'm getting "unknown driver: mssql". Below is the code: scnConexao := TSQLConnection.Create(nil); scnConexao.DriverName := 'MSSQL'; scnCone...

SQL Server newID - how is it created?

I would like to use newId to generate random numbers. Usually you would use it just once, but I might be generating up to 10 random numbers per newId. Is it random enough? ...

Send mail in asp.net without smtp details

Hi Experts, I am using asp.net and C#. I have deployed my application on the server and now I come to know that my server would not provide me SMTP detail , is their any way I could send sms without smtp details. I can use bot asp.net3.5 with C# or SQL Server 2005 to send mail. Thanks in advance ...

Is there any natural join replacement in SQL Server 2005?

Hi, I have two tables which I would like to join by ID field. I was trying to use for this "INNER JOIN". Everything would be good but there are two issues: As a result I receive twice column ID. I have to omit specifying columns which should be displayed under select statement. I would like to use there a *. I red that other sql-s ha...

Remote sql server usage?

I've a user account on a development SQL express on a remote server. This account has all privileges granted to it but when I use SQL express remotely then I'm not able to make changes to tables. If I log into the virtual machine and sign in with same user I can make changes. It says I'm not database owner or system administrator. I thi...

T-SQL: How to know how much storage space is left in sql server express?

How is it possible to know how much of the "DB quota" imposed by SQL Server express edition (4GB in old versions, 10GB in 2008R2) is in use? Let's say I have a DB that is using 1GB, I want to know "9GB of free space". Is it there a T-SQL command for this? ...

Impersonation in asp.net, confused about implmentation when used with Active Directory & Sql Server

I have an internal website that is using integrated windows authentication and this website uses sql server & active directory queries via the System.Directory.Services namespace. To use the System.Directory.Services namespace in ASP.NET I have to run IIS under an account that has the correct privileges and importantly have impersonatio...

Best way to auto-restore a database every hour

I have a demo site where anyone can login and test a management interface. Every hour I would like to flush all the data in the SQL 2008 Database and restore it from the original. Red Gate Software has some awesome tools for this, however they are beyond my budget right now. Could I simply make a backup copy of the database's data fil...

Data retrieval and Join operations with cluster db server

If any database spreads across multiple servers (ex. Microsoft Sql Server), how can we do join or filter operations. In my scenario, if suppose: A single table spreads across multiple servers how can we filter rows based on user input? If master table is there on one db server and transaction table is at another db server, how can we d...

Using SQLQuery.uniqueResult() to perform native SQL INSERTs and UPDATEs

I am using Hibernate in my project and there is a certain scenario where I want to use the uniqueResult() method on the org.hibernate.SQLQuery class to perform native SQL INSERT and UPDATE operations. I did try using the executeUpdate() method on the same class. But I get an error saying that they are used for HQL updates only. Please ...

Need to use query column value in nested subquery

EDIT Sorry for the half post :( It seems I cannot use a column from the parent query in a sub query. How can I refactor this query to get what I need? dbo.func_getRelatedAcnts returns a table of related accounts (all children from a given account). It goes up to the top level parent account of a given account and then selects all ch...

Loading city/state from SQL Server to Google Maps?

I'm trying to make a small application that takes a city & state and geocodes that address to a lat/long location. Right now I am utilizing Google Map's API, ColdFusion, and SQL Server. Basically the city and state fields are in a database table and I want to take those locations and get marker put on a Google Map showing where they are....

Quickest way to fill SQL Table with Dummy Data

What is the quickest way to fill a SQL table with dummy data? I have a wide table with about 40 fields of different kinds (int, bit, varchar, etc.) and need to do some performance testing. I'm using SQL Server 2008. Thank you! ...

SQL Server and MySQL connection pooling: is it really important?

After a lot of problems with my web host, I disabled connection pooling within my application. The problem was related to the number of concurrent connections : only five. The result is that my web app doesn't crash. I didn't notice any poor performance after disabling it. Are there any "collateral" or side effects to disabling con...

Can we connect Sharepoint to SQL Server 6.5?

Not able to import application definition file!! Error: The metadata object with Name 'XYZ' and of Type 'LobSystemInstance' has a Property with Name 'DatabaseAccessProvider' that has either an invalid value or Type. Error was encountered at or just before Line: '10' and Position: '10'. line 10 in ADF: <"Property Name="DatabaseAccessP...