sql-server

SQL Server SELECT Performance with JOINS

Hi, in SQL Server, I would like to know if there is any performance difference between doing this (A)... SELECT a.field1, a.field2, a.field3, b.field1 FROM table1 a INNER JOIN table2 b ON a.IDfield = b.IDfield and this (B)... SELECT a.field1, a.field2, a.field3, b.field1 FROM table1 a, table2 b WHERE a.IDfield = b.IDfield Well, thi...

Storing Date Only in sql server 2005

How to avoid the time portion of the datetime in sql server. I wants only the date portion to insert my database. Thanks in Advance ...

SQL2000 to SQL2005. Query now a lot slower

Hi This query used to take 3secs in SQL2000, now it takes about 70secs. Both databases give the same results. The 2005 database is not running in compatibility mode. Currently we're rebuilding the query to run in SQL2005.. by a process of elimination and understanding the logic. However - can anyone see anything obvious that we've m...

Connecting to SQL Azure

How do I connect using MSSMS (Microft SQL Server Management Studio)? ...

How to clear SQL session state for all users in ASP.NET

I use SQLServer SessionState mode to store session in my ASP.NET application. It stores certain objects that are serialized/deserialized every time they are used. If I make any changes in code of the structure of those objects and I put a new version live, any logged user will get an error, as their session objects (the old version one...

What are the essential dba skills a developer should learn?

Creation of objects like tables and indexes are fairly essential, even if the code has to be authorized or created by the dba. What other areas normally carried out by dbas should the accomplished developer be aware of? ...

Pros/Cons - Encrypting File System (EFS) vs Transparent Data Encryption (TDE) for sql server

I want to encrypt sql server database files (2008) I want to make a choice between EFS and TDE. Any advice? Pros/Cons? ...

Problem With WPF Application And SQL Server Database

I made an application with animations in WPF with Visual Studio 2008 Team System and SQL Server 2005. So I have Windows XP and Windows 7, in Windows XP that I have Visual Studio and SQL Server and Framework 3.5 it works very well, but in Windows 7 and in other computers it can not connect to database, first I thought it's about Framewor...

sp_send_dbmail will not send query results

I've tried every avenue on every damn forum suggested, but to no avail! Need to send results of SQLPERF(logspace), that have been stored in a table, via sp_send_dbmail to recipient. Step 2 of job is where failure occurs. Please help! EXEC msdb.dbo.sp_send_dbmail @profile_name= 'MyDBA', @recipients= '[email protected]', @subject='Log War...

PHP + SQL Server - How to set charset for connection?

I'm trying to store some data in a SQL Server database through php. Problem is that special chars aren't converted properly. My app's charset is iso-8859-1 and the one used by the server is windows-1252. Converting the data manually before inserting doesn't help, there seems to be some conversion going on. Running the SQL query 'set ...

delete all but minimal values, based on two columns in SQL Server table

how to write a statement to accomplish the folowing? lets say a table has 2 columns (both are nvarchar) with the following data col1 10000_10000_10001_10002_10002_10002 col2 10____20____10____30____40_____50 I'd like to keep only the following data: col1 10000_10001_10002 col2 10____10____30 thus removing the duplicates based on t...

Custom Sorting Function - of SQL Server

Hi Guys, I have a column in SQL Server 2005 that stores a version number as a string that i would like to sort by. I have been unable to find out how to sort this column, although i am guessing it would be some kind of custom function or compare algorithm. Can anyone point me in the right direction of where to start? I may be googling ...

sp_MSforeachtable order by

I am using sp_MSforeachtable to get a rowcount of specific tables in my database. I want these ordered by name. How do I add an ORDER BY clause to sp_MSforeachtable? ...

SQL Server - index on a computed column?

I'm joining to a table dozens of different times, and every time, I join (or filter) based on the results of a SUBSTRING of one of the columns (it's a string, but left-padded with zeros, and I don't care about the last four digits). As a result, even though this column is indexed and my query would use the index, it does a table scan bec...

Get current connection protocol in SQL 2000

I'm currently using SQL 2000 (it's a vendor server - don't ask...), and I'm wondering if there's a way to detect the connection protocol of connected clients. For SQL 2005+, I use: select net_transport from sys.dm_exec_connections where session_id = @@spid But SQL2000 lacks this dynamic view. Anybody know the equivalent function on S...

Sending mail when a table is updated

Hi, my name is Tayyeb, I have recently finished my course in SQL Server 2005. I am currently working as a Windows System Administrator. I am a newbie to databases, my question is that we have a database and if a table gets updated then I'd like to receive an email saying what has been updated. Can anyone help me on this solution? Than...

SQL Server 2008 won't let me add foreign keys

I've been using SQL Server for years, so I'm not a noob. I've recently been having problems where I can't add a foreign key to certain tables in my database using SQL Management Studio and SQL Server 2008 Express. The table I'm trying to reference is there and it has a primary key (with the primary key constraint created), but it doesn...

finding performance bottlenecks in ASP.NET

We have MSSQL, some C# web services, some ASP.NET, and some AJAX. We're having terrible load times, normally 2-3 seconds to refresh a page, sometimes far more. I have no idea where to start. What profiling tools are there, across the entire end-to-end, to identify where the biggest bottlenecks are? ...

Multi-threaded code in CLR Stored Procs?

Are multi-threaded CLR stored procs possible? I have a data-intensive task with lots of potential for parallelization. CLR Stored Procs would be great to remove the overhead of moving the data out of process, my I fear that I'd have to give up parallel computing. What are my options? Note: We're on SQL Server 2005 with plans in the ...

Easiest way to import CSV into SQl Server 2005

I have several files about 5k each of CSV data I need to import into SQL Server 2005. This used to be simple with DTS. I tried to use SSIS previously and it seemed to be about 10x as much effort and I eventually gave up. What would be the simplest way to import the csv data into sql server? Ideally, the tool or method would create th...