sql-server

Do SQL Native Client connections need to be reopened after a complete failure of the principal server in a mirrored env?

Hi, I have a connectionstring as below... DRIVER=SQL NATIVE CLIENT;SERVER=TCP:NYAVDEVINTDCDB1,5550; FAILOVER_PARTNER=TCP:NYAVDEVINTDCDB2,5550;DATABASE=DMINTDC; TRUSTED_CONNECTION=YES;POOLING=TRUE; Do SQL Native Clients using this cxn String have to perform a reconnect when the NYAVDEVINTDCDB1 server gets completely disconnected/ loses...

JQGrid and Microsoft SQL Server

Hello all, I am trying to get this awesome JQuery plugin working with SQL Server. I have setup PDO as I use it elsewhere (with MS Access) - I think I have it setup with sql server (2008) now. Here is how I connect: define('DB_DSN',"odbc:Driver={SQL Server};Server=MyInstance;Database=table1;"); define('DB_USER', ''); define('DB_PASSWOR...

Comparing stored procedure performance ex and new version

I did create two new indexes on the tables that are used on a the sp. The new results shows that on the part of problematic joins, the scans are converted to seek. I think seek is better rather than scan operations. On the other hand, the time takes more or less the same duration as it was without new indexes. So clearly, how can i get...

Why some system functions in T-SQL without parameters have parenthesis while others don't?

I never remember if a system T-SQL function, with no parameters, requires parenthesis, so I wonder if there is a reason. For example: CURRENT_TIMESTAMP is a function that doesn't require parenthesis, while SCOPE_IDENTITY() requires them. ...

Partitioning of the database in SQL Server 2005

My project modules are organized in such a way that I have to maintain following Database structure. I've 5 schemas, each containing 20 to 50 tables. Each schema is associated with one module of the project. All the tables that are used within more than one modules are kept in "COMMON" schema. Each module takes 2 to 5 months to finish....

SQL query to search for a record that has a certain text?

How can I query for a record that has certain text input from the user? For example in my table adapter function: SELECT Word, Description, Example FROM WordLists WHERE (Word LIKE @SearchKey OR Description LIKE @SearchKey OR Example LIKE @SearchKey) Obviously only record that has the exact text from certain input will be acquired...

VS 2008 Schema Compare: How to ignore server variables

Hi, I recently imported the schema of our prod database into Visual Studio. The schema solution builds, and I've used server variables in the sproc scripts. e.g., cross-db call in a sproc which was MyDB.dbo.sp_Some_Sproc is now [$(MyDB)].dbo.sp_Some_Sproc However, as it's taken a while to get up and running properly with TFS etc., t...

Filter based on an aliased column name

I'm using SqlServer 2005 and I have a column that I named. The query is something like: SELECT id, CASE WHEN <snip extensive column definition> END AS myAlias FROM myTable WHERE myAlias IS NOT NULL However, this gives me the error: "Invalid column name 'myAlias'." Is there a way to get around this? In the past I've included the...

SQL Data input "echoing"

I have a C# program that reads data from a SQL server instance using ADO.Net. What I'd like to be able to do is hook-up a module that will echo any input data read from the database while the program is running to an empty database with the same schema. This would allow a minimal data set to be created dynamically for that particular r...

Is IF Executed either way?!!!

I am getting errors executing the following statement: /* AccountTypes Constraints */ IF EXISTS (SELECT 1 FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[AccountTypes]') AND type in (N'U')) BEGIN PRINT 'Table [AccountTypes] exist.' IF NOT EXISTS(SELECT 1 FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK_Accoun...

Updating Stored Procedure on Three Different Servers

I need to update the SQL SERVER stored procedure on three different servers. I do not like to perform this manually. What are my options? ...

How build a scalable (relational) database for Petabytes+ of data?

More a general brainstorming question: what is the state-of-the-art in designing a (relational) database which scales to very large amounts of data? And given today's technology trends, how do we expect to design them in 5-10 years? By scalabiliy, I mean in particualar the ability to increase capacity with linear cost by adding hardware...

Separate tables/databases for reporting and CRUD operations

Periodically users running reports are blocking users doing CRUD operations and causing time-outs. I'd like to create duplicate locations of the current tables for the report users. I was thinking of creating a job that backs-up my app's database, and restores it to a reporting database on the same server so that users running reports w...

SQL Server 2005 Reporting Services - Configuring the Unattended Account - Invalid domain\alias

I'm trying set up an execution account following the steps here: http://msdn.microsoft.com/en-us/library/ms156302.aspx I follow these steps: Start the Reporting Services Configuration tool and connect to the report server instance you want to configure. On the Execution Account page, select Specify an execution account. Type the ac...

Comma Delimited SQL string Need to separated

I have this string that i am getting from .net application A,B,C,D,E,F, I wanted to write a sql select statement like set @string = 'A,B,C,D,E,F' select * from tbl_test where tbl_test.code in (@string) This wont work in t-SQL because it is using the @string as one string it is not separating the values. Is there any ways i can do ...

Query optimisation

In my application, my module uses the following tables PUBLIC_APPLICATION CATEGORY_MASTER NOTIFICATION_SITE_DETAIL DIMENSION_MASTER DM PUBLIC_REGISTRATION ALLOTMENT_NOTIFICATION. From the following tables I am retrieving the data SELECT PA.REGISTRATION_NO,PA.APP_ID,PA.NO_OF_ATTEMPTS,CM.CATEGORY_NAME, DM.SITE_DIMENSION,PR.B...

Adding text to a field to make it unique

I am using SQL Server 2000, I have a situation where I am copying data over from one table to another, the destination data table requires each Name row to be unique. Here is a quick example of my issue Source table RowID | Name 1 A 2 B 3 B 4 B 5 C 6 D 7 C What I want to do is turn it in to th...

SQL Server Check Contraint and checking Signed In/Out state

I have a table that functions as an event log and stores the users signed in state, 'In', 'Out', or 'Rejected' (sometimes users my be 'Rejected' based on external criteria). Here is some sample data so you can get an idea of what the table looks like: Table MyTable PersonID - State - DateTime // data sample 156 - 'Out' ...

Need help writing script to run profiler on the server.

I need to create a single trace file that spans several days for one of my databases. This server also restarts every night. I was told that I should create a script to start the trace every time the server starts but i've been having trouble finding information on just what my script should look like to accomplish what it needs to do....

should I create another table for 0 or 1 entries?

Hello, I have a payment_types table in which you can enter different payment types such as direct debit, credit card, credit card on file, etc. for an event. For each payment type, you can specify whether to allow user to pay by installment and what the start and end date and number of installments it should allow. Should I have a sep...