sql-server

Synchronizing intranet and web data

I am just getting started breaking a .NET application and its SQL Server database into two systems - an intranet and a public website. The various database tables will need to be synchronised between the two databases in different ways, for example: Moving from web to intranet, with the intranet data becoming read-only Moving from int...

Allow anonymous access to SQL Server 2008

I need to set up a "throw-away" instance of SQL Server 2008 for students to test a program for a few weeks. SQL Server 2008 is running on a virtual instance of Windows Server 2008. The server is not a member of the domain. The client computers that need to connect to the SQL Server are domain members, as are the student accounts. The cli...

SQL Table with parent and child nodes (navigation table)

Hi all, I have a single table with both parent and child nodes, and each has an order number in it. I am trying to write a single query to output them in order, its for a navigation list with categories and sub-categories. I could manage it in code rather than in the SQL query but it would involve calling a query from within a query ...

SQL Server SMO create Auto Numbering Index Column

Dear All, I have a project in C# where I create my tables in SQL server using the Server Management Objects for SQL Server in my program. I need to create a column using SMO in C# where the primary key field is an autonumbering field. Can someone tell me how that is accomplished using SMO in C#? Tony ...

Performance of COUNT SQL function

Hi All, I have two choices when writing a SQL statement with COUNT function. SELECT COUNT(*) FROM SELECT COUNT(some_column_name) FROM In terms of performance what is the beast SQL statement? can I obtain some performance gain by using option: 1 ? Thanks, Upul ...

Changes to sysusers and sysxlogins in SQL 2008

Hi all, I am currently updating a MS SQL 2000 server to SQL 2008. One of the issues highlighted by the Upgrade advisor is that the undocumented table sysxlogins has been removed. I currently have a procedure that is run by a user 'foo' to determine if the user 'bar' exists in the database blah. If the user exists the user's password is...

What size are the biggest SQL Server database installations in the world?

I'm interested in what is the potential of SQL Server when it comes to volume of data (size of the database, number of rows, etc.). ...

Best way to deploy VB.NET Code / create an assembly on a SQLServer

I've created some functions / procedures with VB.NET and want to deploy them to a SQLServer. Within Visual Studio you can click right and select "deploy". An assembly will be created on the server and a lot of functions and procedures. It's really easy. Now I want to script the whole deployment process. What is Visual Studio doing when...

SQL Server hosting options

Hello, I am trying to find out what my options are for SQL Server hosting. The reason I am asking is because it always seems to be a problem getting the right kind of hosting for SQL Server. I mostly need a few small databases(<3Mb) for testing or to temporary store some data for clients when I am working on their website. I could just...

Help determining Maintenance Item table structure best practice

I have two different existing Database design's in the legacy apps I inherited. On one side they created two tables; tblAdminMaintCategory and tblAdminMaintItems. On the other side individual tables for everything; tblAdminPersonTitle and tblAdminRace. Method #1 Now in the first example there would be an entry in tblAdminMaintCategor...

How to compare data file with column in SQL server database?

I am required to compare data in a file with a column in SQL server database. I have been asked to use Microsoft Access to do the same. Additional information: File consists of many lines of text. Amongst the text is the a word that matches the column name of SQL server database. How should go about doing the comparison? If I use MS ...

SQL Server 2005 query plan optimizer choking on date partitioned tables.

We have TABLE A partitioned by date and does not contain data from today, it only contains data from prior day and going to year to date. We have TABLE B also partitioned by date which does contain data from today as well as data from prior day going to year to date. On top of TABLE B there is a view, View_B which joins against View_C,...

SQL Server - transactions roll back on error?

We have client app that is running some SQL on a SQL Server 2005 such as the following: BEGIN TRAN; INSERT INTO myTable (myColumns ...) VALUES (myValues ...); INSERT INTO myTable (myColumns ...) VALUES (myValues ...); INSERT INTO myTable (myColumns ...) VALUES (myValues ...); COMMIT TRAN; It is sent by one long string command. If one...

Can I do it only with SQL Queries or do I need a stored procedure?

Hi guys. I came across with a problem in which I need some advice/help. Background: I'm programming a map in an accounting software which requires special formatting and a tree-like hierarchy between the account codes, i.e.: Account 1 is the father of accounts 11, 12 and 13; On the other hand, account 11 is the father of accounts 11...

SQL: Inner joining two massive tables

Good afternoon, I have two massive tables with about 100 million records each and I'm afraid I needed to perform an Inner Join between the two. Now, both tables are very simple; here's the description: BioEntity table: BioEntityId (int) Name (nvarchar 4000, although this is an overkill) TypeId (int) EGM table (an auxiliar table, in...

SQL Server 2005 Index Fragmentation

Several keys in a SQL Server 2005 database I inherited have very high fragmentation percentages. When using the following SQL: select OBJECT_NAME(object_id), avg_fragmentation_in_percent, record_count, * from sys.dm_db_index_physical_stats (DB_ID(N'FragmentedDB'), NULL, NULL, NULL, 'Detailed') s I see that several tables with fra...

Precision nightmare in Java and MSSQL

Hi everyone, I've been struggling with precision nightmare in Java and MSSQL up to the point when I don't know anymore. Personally, I understand the issue and the underlying reason for it, but explaining that to the client half way across the globe is something unfeasible (at least for me). The situation is this. I have two columns in ...

how can i find out how busy sql server is with IO using @@IO_BUSY

I am trying to find out how busy my sql 2000 server in terms of CPU and IO through a T-SQL query. currently I am using the following to find the CPU Usage %: DECLARE @CPU_BUSY int , @IDLE int SELECT @CPU_BUSY = @@CPU_BUSY , @IDLE = @@IDLE WAITFOR DELAY '00:00:00:500' SELECT (@@CPU_BUSY - @CPU_BUSY)/((@@IDLE - @IDLE...

SQL Server query runs slower from ADO.NET than in SSMS

I have a query from a web site that takes 15-30 seconds while the same query runs in .5 seconds from SQL Server Management studio. I cannot see any locking issues using SQL Profiler, nor can I reproduce the delay manually from SSMS. A week ago, I detached and reattached the database which seemed to miraculously fix the problem. Today whe...

How to warm up a sleeping SQL Server database

We have a job which runs every morning in CruiseControl.net to import a datafile into a DB. Our problem seems to be that some nights the DB goes to sleep over night. When we run the script in the morning our connection times out while we wait for the DB to warm up. We've tried upping timeouts etc. but with no luck. Is there a way to tell...