sql-server

How to deal with SQL column names that look like SQL keywords?

One of my columns is called "from". I can't change it, I didn't make it. Am I allowed to do something like "SELECT from FROM TableName"? Or is there a special syntax to avoid the SQL server being confused? I am using Microsoft SQL Server (express i think) and Java JDBC, if that matters... Thanks Nathan ...

numeric(38,0) as primary key column; good, bad, who cares?

Hi, On my current project, I came across our master DB script. Taking a closer look at it, I noticed that all of our original primary keys have a data type of numeric(38,0) We are currently running SQL Server 2005 as our primary DB platform. For a little context, we support both Oracle and SQL Server as our back-end. In Oracle, our pri...

Service Unavailable in IIS

When I access a wrong call to a sql server data into my application in classical ASP I get this message in my entire site: Service Unavailable. It stopped. My site is in a remote host. Don´t know what to do. What can I tell to the "support team" of them to fix that? ...

Finding head and tail events in SQL Server (Optimisation)

I have a table of events, I need to find all tail events of type 1 and all head events of type 1. So, for the set of events in this order [1, 1], 3, 1 ,4, 5, [1,1,1] the brackets denote head and tail events of type 1. This is much better illustrated in SQL: drop table #event go create table #event (group_id int, [date] datetime, [t...

Can't connect to SQL Server Express using sqlcmd.exe

Hi All, Env.: Vista SP1, SQL Server Express 2005 I'm able to connect to my localhost SQL Server using SQL Server Management Studio, using Windows authentication and, to the best of my knowledge, all default parameters, including network protocol. Now I try to connect using sqlcmd.exe to no avail: C:\Program Files\Microsoft SQL Server...

A powerful management tool for MySQL with similar features to SQL Server Management studio

I am currently working with a developer who is experinced at MsSQL, but not much at MySQL. He has been cursing MySQL for having Bugs, and also being far harder to use. Is is becuase his experince has been so good with Managment studio. It seems to me that his problems are with using phpMyAdmin. For example, he cites not being able to c...

Sheduled run of stored procedure on MS SQL server

Is it possible to set up somehow Microsoft SQL Server to run automatically a stored procedure on regular basis? ...

Retrieving SQL Server Full Text Index terms

Using Lucene, one can retrieve the terms contained within in an index, i.e. the unique, stemmed words, excluding stop-words, that documents in the index contain. This is useful for generating autocomplete suggestions amongst other things. Is something similar possible with MS SQL Server full text indices? ...

Transaction level, nolock/readpast and concurrency

We have a system that is concurrently inserted a large amount of data from multiple stations while also exposing a data querying interface. The schema looks something like this (sorry about the poor formatting): [SyncTable] SyncID StationID MeasuringTime [DataTypeTable] TypeID TypeName [DataTable] SyncID TypeID DataC...

Reducing the overhead of a SQL Trace with filters

We have a SQL 2000 server that has widely varied jobs that run at different times of day, or even different days of the month. Normally, we only use the SQL profiler to run traces for very short periods of time for performance troubleshooting, but in this case, that really wouldn't give me a good overall picture of the kinds of queries t...

Creating 1K IDs, assigning a transactionID to all the rows with concurrency in mind.

Hi, A client is going to request 1K rows of IDs from the server. I have to make sure we have 1K ID's with clientID = -1, if not, I have to insert 1K new ID's into the table. I then have to link those 1K ID's with the clientID return reserved 1K ID's to the client. Is it as simple as wrapping all of this into a Transaction? ...

Find out sql server hardware or speed test

I use an sql server regularly and have recently been getting frustrated by the performance. It would be difficult for me to get direct access to find out the hardware so: Is there a direct way in management studio to assess performance or find out the exact hardware. Alternatively does someone have a set of test sql procedures I could ...

How do you add a NOT NULL Column to a large table in SQL Server?

To add a NOT NULL Column to a table with many records, a DEFAULT constraint needs to be applied. This constraint causes the entire ALTER TABLE command to take a long time to run if the table is very large. This is because: Assumptions: The DEFAULT constraint modifies existing records. This means that the db needs to increase the size ...

SQL inline if statement type question

Hi, I'd like to make an (MS)SQL query that returns something like this: Col1 Col2 Col3 ---- --------------------- ------ AAA 18.92 18.92 BBB 20.00 40.00 AAA 30.84 30.84 BBB 06.00 12.00 AAA 30.84 30.84 AAA 46.79 46.79 A...

SQL Server xp_cmdshell

Is their any other way to get a list of file names via T-SQL other than INSERT INTO @backups(filename) EXEC master.sys.xp_cmdshell 'DIR /b c:\some folder with sql backups in it I am attempting to get a list of sql backup files from a folder to restore and I do NOT want to use the xp_cmdshell for obvious security reasons. ...

How do I add the identity property to an existing column in SQL Server

In SQL Server (in my case, 2005) how can I add the identity property to an existing table coulumn using t-sql? something like: alter table tblFoo alter column bar identity(1,1) ...

SQL Server 2005 and iTunes Library

what's the easiest way to bulk load my iTunes library xml into an existing SQL Server database? ...

Can SQL Server 2008 Reporting Services use a list of objects as a data source in a ASP.NET application

I am working on an ASP.NET (3/5) web application. In the application, we assemble lists of classes from a variety of data sources. I would like to create a report in SQL Server SSRS that renders a report from the contents of one of those lists, without pushing the list to the database (in fact, it would be a violation of a bunch of rul...

What GOOD tools are available for generating ERD from a SQL Server Database?

I am trying to generate an Entity Relationship Diagram from an existing MS SQLServer 2005 database. What tools are available? Specifically,I am not only interested in ERD's more directly I am looking for a tool to help quickly learning and analysing a medium size (schema wise not really row wise) database structure. ...

Does the SQL Server 2008 search problem affect SharePoint search?

Does anyone know if the problems that have been affecting Stack Overflow with regards to SQL Server 2008 Full Text Search performance have implications for the search in SharePoint? As far as I understand it SharePoint search uses SQL Server full text search. ...