sql-server

The dbo. prefix in database object names, can I ignore it?

I am looking for a performant default policy for dealing with the .dbo prefix. I realize that the dbo. prefix is more than syntactic noise, however I got through the past 8 years of MS based development skipping typing the dbo. prefix and ignoring its function. Apart from a performance issue with stored proc compile locks is there a d...

How would I save various selected options on an ASP.NET form to SQL Server to be recalled as a "saved" report?

I have an ASP.NET WebForm with a number of DropDownLists, multiple select enabled ListBoxes, CheckBoxes and TextBoxes. What I would like to be able to do is allow the user to save all the selected options and call it a name as a saved report. This would then allow them to click to retrieve the selections they made when they come back to...

How do I give all users permissions to a SQL Server 2008 instance?

I have created an ini file that installs/creates a SQL Server instance. I am able to connect and modify the databases attached to this instance fine. However, if anyone else logs onto the machine, they can start the service fine but then get errors when trying to open connections. What I need is for all users that log into the machine...

SSIS can't find 32-bit ODBC Driver in Debug mode

I am on a 64-bit Windows 2008 server. In SSIS I have an ADO.NET Data Flow Item connected to an ODBC connection. Preview works fine. When I execute in DEBUG mode the following exception is thrown: [ADO NET Source [53]] Error: System.Data.Odbc.OdbcException: ERROR [IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no ...

SQL Server 2008 won't let me enable the 'sa' user

I normally use the sa user for development, but SQL Server isn't letting me enable the account. It says: Cannot set a credential for principal user 'sa' When installing it I set it up with mixed mode. ...

SQL Server Column Display Order

When you create a table via scripts it appears to just list the columns in order of creation. It's a minor annoyance, but I like a certain method to the madness. When I later add a column with ALTER TABLE, how do I make it show up in a specific place when viewing the table in interactive tools such as enterprise manager? ex: Table Fo...

What is wrong with my ADO.NET code?

Can any one help me to identify the error in this program using ADO.NET... Code: using System; using System.Collections.Generic; using System.Text; using System.Data; using System.Data.SqlClient; using System.Transactions; // the code is showing an error in this line class Program { static void Main(string[] args) { try ...

ssis connection manager not storing sql password

I used to have a dts that had sql server authentication connection. Basically the userid password is stored in the package itself. Now when I go to SSIS the password is not getting stored to the package. I saw this when I google the problem. http://social.msdn.microsoft.com/Forums/en-US/sqlintegrationservices/thread/c720e694-2f58-483a-9c...

The multi-part identifier "DB1..Students.studentnumber" could not be bound.

SELECT (SELECT Grade FROM DB2..Students WHERE DB2..Students.studentnumber=DB1..Students.studentnumber AND ISNULL(Students.Disable,'') != 'T' ) as test,* from DB2..Students WHERE studentnumber IN ( SELECT studentnumber FROM DB2..Students where AND ISNULL(studen...

Which SQL statement is more efficient joins or exists

I have 2 tables, orderData and stagingOrderData. I need to see if there are any rows in the stagingOrderData which exists in the orderData so I can delete them from the stagingOrderData table before I import. Test cases - I tried a join select * from dbo.stagingOrderData s inner join dbo.OrderData o on s.productid = o.productid and s....

What kind of permission I need to assign (Reporting Service)?

I am doing some work in Reporting Service 2005. I need to call a COM object so I wrapped the call in custom assembly. The approach worked in preview. But when I deployed the report I ran into #Error. Microsoft has a KB article about this: http://support.microsoft.com/?kbid=842419 It says that I have to assert permission in my custom as...

Fast way to add line/row number to text file

I have a file wich has about 12 millon lines, each line looks like this: 0701648016480002020000002030300000200907242058CRLF What I'm trying to accomplish is adding a row numbers before the data, the numbers should have a fixed length. The idea behind this is able to do a bulk insert of this file into a SQLServer table, and then pe...

Rebuilding large SQL indexes isn't changing the fragmentation percentage

I have a large database running on SQL Server 2005. I query the DMV sys.dm_db_index_physical_stats to get index fragmentation information. I was shocked to see avg_fragment_size_in_percent reporting a large amount of indexes with very bad fragmentation levels (99% for a lot of them). These are on tables with non-trivial page counts (...

ASPNETDB.mdf for MySQL

Does anyone have or know where I can get a version of the ASP.NET bundled database ASPNETDB.mdf for MySQL? Thanks :) ...

How can I set up a simple calculated field in SQL Server?

I have a table with several account fields like this: MAIN_ACCT GROUP_ACCT SUB_ACCT I often need to combine them like this: SELECT MAIN_ACCT+'-'+GROUP_ACCT+'-'+SUB_ACCT FROM ACCOUNT_TABLE I'd like a calculated field that automatically does this, so I can just say: SELECT ACCT_NUMBER FROM ACCOUNT_TABLE What is the best way to do ...

Will an EXISTS query still lock a table?

IF NOT EXISTS(SELECT * FROM MyTable WITH(nolock) WHERE Key = 'MyKey') INSERT MyTable(Key) Values('MyKey') If The value does not exist in the table, does the query aquire a lock? ...

Cannot Find Stored Procedure Error

I recently did an import of database from a sql server 2000 database to a sql server 2005 database. I've gone through and setup what I thought were the same login credentials and owner permissions that I had previously setup in my old database. All of the code base I'm working has stored procedures listed simply by stored procedure name...

SQL Server 2005 XML data type

UPDATE: This issue is note related to the XML, I duplicated the table using an nvarchar(MAX) instead and still same issue. I will repost a new topic. I have a table with about a million records, the table has an XML field. The query is running extremely slow, even when selecting just an ID. Is there anything I can do to increase the spe...

ADO.NET Connection Pooling and implications for AutoClose = True

Setup: I'm creating a .NET WinForms application in C# to allow our technical support folks to easily perform common tasks against our product's SQL Server 2005 database. The application is using ADO.NET (SqlConnection) to connect to the database. One concern in developing this application was to minimize the overhead of connecting/re-...

how to search field name in table sql server2005

any software or source code can used? i have many table i database 200+ table and my boss give some project and requirement and not give information for table but give field name and i would like to find field name for query some condition but i don't know this field in where table and i to solved its ...