sql-server

Connecting to SQL 2005 from a windows mobile device

I am trying to write a simple application that runs on a Windows Mobile 6 device and can connect to a SQL 2005 server and read and write to the database. It is ok if it only connects to the SQL server while it is docked. I have never worked with mobile devices, so I may be thinking about it incorrectly. I created a DataSet and a Table...

Check for Numeric Value using SQL Server 2000

How can I know if a VARCHAR field's value can be successfully converted to an integer? I want to do it massively to insert records from one table to another... ...

FTS in sql 2005

Can somebody please, let me know that how do we find that full text search is enabled in SQL 2005. ...

php against sql server 2005 is timing out

I'm running a php script from the command line against SQL server 2005 using the MS driver for PHP and getting time outs. The query takes about 2 minutes from SQL Server Management Studio and returns > 300,000 rows. There are multiple queries in the script and for each one I do a sqlsrv_connect(), execute the query and then sqlsrv_free_...

SQL Server Automatic Partitioning of Large Database Tables

I am dealing with database tables with tens of millions of rows (with the potential to go to the hundreds of millions over time), and am looking at implementing database partitioning to try to keep performance stable as the row count increases. This is what I'd like to do: Say I have a table that stores animals. One of the fields is the...

SQL Server developer Edition License and CAL

Hi, I have to test my product with SQL Server database. Based on the search, I know I have to get hold of Developer Edition. I need to know whether for my team of 10 to access the database for testing needs 10 CALs or 10 developer licenses? I searched enough in the net but couldn't find a straight answer. My test setup will be like,...

Multiple SqlString actions at different sequences in Wix

I'd like to execute SQL strings at two different sequences in the InstallExecuteSequence. The problem is that it seems if you use the supplied <sql:SqlString \>, they get bundled into the 'InstallSqlData' action. Is there a way to specify that certain SqlString elements get executed at a different stage (so that I can run a separate cu...

Converting an integer to a 0-padded string

In SQL Server 2008, I want to represent an integer as a 3-character string - so: 3 becomes '003' 5 becomes '005' 107 becomes '107' How can I do this? ...

SQL Agent Job - to execute as queue

I have a job which is calling 10 other jobs using sp_start_job. The job is having 10 steps, each step calling each sub jobs, When i execute the main job, i can see it started with step 1 and in a few secods it shows 'finished successfully' But the jobs take long time time, and when i see the log mechanism i have put inside , it shows the...

Lock a table in SQL Server

Is there a command/SQL query to lock a particular table in MS SQL Server to stop all related transactions using ODBC? ...

Sql query to overlay date/period overrides over default dates

Any ideas on building a Sql Server (2008) query that will give me say the "date specific prices for an item based on the default or override where exists". So a Default table might look like this - columns Price, StartDate, EndDate (yyyy-M-d): Default: $10, 2010-1-1, 2010-2-1 The Override table like this: Override: $12, 2010-1-5, ...

Error while exporting from ms sql to access

I am trying to export the following data in the query from ms sql server to access, it says an error "Field wkid already exists in the table results" when i try to execute the same using sql query analyser, its not giving any error.i am getting the results in the grid Select a.wkid,a.stid,a.pfid,pf.pfname,a.modid,mm.md,a.catid, [sp],re...

Arrays in UserDefinedFunctions?

I created a User Defined Function with VB.NET and want to use that function in SQLServer. Everything seems to work fine. Now I want to use an array as parameter. Is it possible? Example of my test method (without parameters): Partial Public Class UserDefinedFunctions <Microsoft.SqlServer.Server.SqlFunction()> _ Public Shared ...

Query Performance of joining before or after UNION

Let's say we have a query that is essentially using a union to combine 2 recordsets into 1. Now, I need to duplicate the records by way of typically using a join. I feel option 1 is in my opinion the best bet for performance reasons but was wondering what the SQL Query experts thought. Basically, I "know" the answer is "1". But, I am...

How to Display a value for the dates?

Using SQL Server 2005 Database1 Table1 ID Date Status 001 23-02-2009 Worked 001 24-02-2009 001 25-02-2009 001 26-02-2009 Worked 002 24-02-2009 Worked 002 25-02-2009 002 26-02-2009 002 27-02-2009 002 28-02-2009 Worked ..., Database2 Table2 ID FromDate ToDate Reason 001 24-02-2009 25-02-2009 ShortLeave 002 25-02-2009 27-02-2009 M...

How to set username and password for particular days?

Using VB.NET and SQL Server 2005 In my software I am using login page with UserName and Password. Suppose I am setting a username and password work for 20 days. After 20 days, when I try to login in software, the software should not to allow to login. Is possible to make a SQL query or VB.NET code. Can any one provide a sample code o...

How do I get around a 'circular reference' in an Inner join

Hi, I have the following 'circular dependency' in my Inner Join, any ideas how to get round it? SELECT *FROM Reference INNER JOIN ReferenceInActivity ON Activity.ActivityID = ReferenceInActivity.ActivityID INNER JOIN @tbActivity AS Activity ON ReferenceInActivity.ReferenceID = Reference.ReferenceID I get the error: Msg 4104, Level 1...

CREATE DATABASE using file in default path

I want to create an SQL script that creates a database. Right now, I have this: CREATE DATABASE [Documents] ON PRIMARY ( NAME = N'Documents', FILENAME = N'Documents.mdf') LOG ON ( NAME = N'Documents_log', FILENAME = N'Documents_log.ldf') COLLATE SQL_Latin1_General_CP1_CI_AS However, this generates the following error: Msg 5105,...

How do you get a Microsoft Access form to refresh a computed column?

Hello, I have a Microsoft Access form that is bound to a linked SQL Server table that has a computed column. I have a control bound to the computed column. I already realize that the computed field cannot be refreshed until AFTER a record is saved. Beyond that, what is the best way to refresh that textbox that is bound to the compute...

Multiple SQL UPDATE statements OR Single with CASE in it?

I've built a trigger where I am trying to keep priorities in order and not allow duplicate priority values. There are some things to consider. The user can free form the priority in. There is nothing blocking them from picking the same priority as another item. When a value is entered equal to another value the newly prioritized ite...