sql-server

Can an SQL Server application role issue DBCC DBREINDEX?

I have an application that uses a SQL Server application role on the database side. During one of the application’s processes, I need it to reindex a table, however, I run into problems because apparently the application role doesn’t have permissions to run the DBCC DBREINDEX command. Do you know of a way to enable that? Here’s the erro...

2008 SQL Server Express Load Balancing

Hi, I have 3 home PCs that have 2008 SQL Server Express instances installed on each one of them... but right now only one has my database and I'm also running an application on that machine that requests a bunch of data from the database. I don't know a whole lot about server architecture, but I have read some guides from Microsoft's we...

Comparison: Tools for generating Excel-documents on the server

Hi! I have a requirement to generate Excel-documents, for Excel XP and forward. I also need to be able to export data from Excel-documents. The requirements are: This needs to be done on the server. No automation of Excel. Sometimes rather large amount of data (~10 000 rows) The Excel-documents should be based on a predefined document...

How do you strip a character out of a column in SQL Server?

How do you remove a value out of a string in SQL Server? ...

Query times out in .Net SqlCommand.ExecuteNonQuery, works in SQL Server Management Studio

Update: Problem solved, and staying solved. If you want to see the site in action, visit Tweet08 I've got several queries that act differently in SSMS versus when run inside my .Net application. The SSMS executes fine in under a second. The .Net call times out after 120 seconds (connection default timeout). I did a SQL Trace (and col...

Approaches to table partitioning in SQL Server

The database I'm working with is currently over 100 GiB and promises to grow much larger over the next year or so. I'm trying to design a partitioning scheme that will work with my dataset but thus far have failed miserably. My problem is that queries against this database will typically test the values of multiple columns in this one ...

SQL Server *= Operator?

Today while inside a client's production system, I found a SQL Server query that contained an unfamiliar syntax. In the below example, what does the *= operator do? I could not find any mention of it on MSDN. The query does execute and return data. As far as anyone knows, this has been in the system since they were using SQL Server 2...

Can Linq to SQL coexist with ADO in SQL Server Express?

I have a single-user Win Forms application that uses an SQL Server Express database via ADO.NET. I want to add more to my app, but by using Linq to Sql (while I learn Linq to Sql). I am unable to see the database in two places simultaneously. Either I can see it in the original code using ADO, or I can see it with the new code using L...

What are the advantages/disadvantages of using mdf vs sql db server

What is the difference between using SQL Express .mdf file and an actual SQL Server DB? Why wouldn't I use .mdf file for everything? Is there a size or performance limitation that would prompt me to use SQL Server DB? I currently use actual SQL Server DB's for every project I work on so I am just curious to know if an .mdf file might be ...

How to write an xquery containing sequence elements?

I've got a very large xml data set that is structured like the following: <root> <person> <personid>HH3269732</personid> <firstname>John</firstname> <lastname>Smith</lastname> <entertime>01/02/2008 10:15</entertime> <leavetime>01/02/2008 11:45</leavetime> <entertime>03/01/2008 08:00</e...

What sort of audit information is stored by sql server when a CREATE TABLE or ALTER TABLE operation is performed?

The inspiration for this question is a stored proc broke on me because it called another stored proc that inserted data in a table whose schema was completely altered. The question is you have a table in a SQL Server database, and you don't know how it got there. You don't have any DDL triggers in place for custom audit information, and...

Sql Server permissions problem

I have a database Mydatabase with a view in it, MyView. I want any user who is a member of the Public role to be able to select from the view. I've done GRANT SELECT ON MyView TO [Public], created a test login on the sql server called Test and made it a member of the Public role, but still can't select the View. What am I doing wrong?...

PDO Stored Procedure return value

Hey I'm working with a SQL Server stored procedure that returns error codes; here is a very simple snippet of the SP. DECLARE @ret int BEGIN SET @ret = 1 RETURN @ret END I can get the return value with the mssql extension using: mssql_bind($proc, "RETVAL", &$return, SQLINT2); However, I can't figure out how to access the return va...

application has failed to start because the side by side configauration is incorrect

HI I have creted an exe by c++ using visualstudio. I have creted a com componet which discover all the instances of sqlserver on particular machine.now in c++ program using visualstudio i write main() and consume the com component. Now it should worrk on my both workstations which are w2k3 machines.And when i try to run the same on w2...

How do I update tables in SQL so that related strings match?

Suppose I have 2 tables Table1 ID Path -- ---- 1 PathA 2 PathB 3 PathC 4 PathD Table2 ID Path Table1ID -- ---- -------- 23 PathA 1 24 PathX 2 25 PathC 3 26 PathZ 4 In the above, PathX should be PathB and PathZ should be PathD How do I sync all the path values in Table2 with values in Table 1, the tables could be large so woul...

DTSX package to upload a table from Access Database to SQL Server

The Problem: I recive monthly data updates for a SQL databse shipped to me in an ACCESS database, there are about 30 tables that follow this pattern the largest table contains ~40k rows. CREATE TABLE [dbo].[TABLE_NAME_HERE] ( [title] nvarchar (255) NULL, [classification1] nvarchar (255) NULL, [classification2] nvarchar (255) NULL, [...

SQL Error with Order By in Subquery

Hi all. i m working sql server 2005. My query is: SELECT ( SELECT COUNT(1) FROM Seanslar WHERE MONTH(tarihi) = 4 GROUP BY refKlinik_id ORDER BY refKlinik_id) as dorduncuay And the error: The ORDER BY clause is invalid in views, inline functions, derived tables, subqueries, and common table expressions, unless TOP or FOR XML is also...

Accessing huge data from Remote Server in C#

Hi, I have a database based in NY and my HK users are trying to get the data from this database. The data retrieved is approximately 20 mb (if you save the Datatable as csv the file size is 20 mb). It is taking around 20 mins for the data to come. I am using SQL Server 2005 as database and c# as desktop application. I cannot have a se...

Sql Server 2005 Primary Key violation on an Identity column

Hi everyone, I’m running into an odd problem, and I need some help trying to figure it out. I have a database which has an ID column (defined as int not null, Identity, starts at 1, increments by 1) in addition to all the application data columns. The primary key for the table is the ID column, no other components. There is no set of d...

Increasing Alphanumeric value in user defined function

Hello, I'm trying to code a user defined function under SQL Server 2005 that will increase integer part of alphanumeric value by one. For example, uf_AlphanumericIncrease ('A000299') should return 'A000300'. Here's what I've done so far; ALTER FUNCTION uf_AlphaNumericIncrement ( @ID varchar(10) ) RETURNS VARCHAR(10) AS BEGIN DECL...