sql-server

Development standards for SQL Server supporting services?

I am trying to find some development best practises for SQL Server Reporting Services, Analysis Services and Integration Services. Does anyone have some useful links or guidance they can offer on this subject? ...

How do I log the frequency and last-used time for a stored procedure?

I want to know how often a set of stored procedures run, and the last time they were used. I am thinking of adding calls to the top of every stored procedure in the database to insert/update a table, with the following schema: SprocName ExecCount LastExec ---------------------------------- GetCompany 434 2009-03-02 Expor...

How to pass a null variable to a SQL Stored Procedure from C#.net code

Hi, Im calling a SQL stored procedure from a piece of C#.net code: SqlHelper.ExecuteDataset(sqlConnection, CommandType.StoredProcedure, STORED_PROC_NAME, sqlParameters); where the sqlParameters variable is defined as: SqlParameter[] sqlParameters = new SqlParameter[SQL_NUMBER_PARAMETERS]; Log.Logger.Debug(string.For...

Advanced Search using CheckboxList

I have an advanced search that I need to implement for a website using C# and SQL Server. Here is the basic idea: User selects required search criteria - city, state, zip User can select optional search criteria. This search criteria is a checkbox list. The checkbox list is databound to a list of criteria from sql server. The search ha...

Downsides (If any) With SQL Server 2005 XML Datatype

I have a need to record XML fragments in a SQL Server 2005 database for logging purposes (SOAP messages, in this case). Is there any reason to use the XML datatype over a simple varchar or nvarchar column? I can see instances already where being able to use XPath to get into the data in the XML would be rather nice, and I haven't been a...

Invoke action on SQL Server 2000 Table Change

There any way to let an application know if there is any specific change on a database table (like an insert, update...) without checking the database in a specific interval? The database server is a SQL Server 2000 Enterprise Version Something like triggers but on the application level. Thanks, rAyt ...

Extra Bytes in File Extracted from SQL Server 2000 Database

I am migrating all my company's customer data to a new CRM system, and the old legacy database is on a SQL Server 2000 server. I can extract all data in the tables via T-SQL queries but run into a brick wall when it comes to file attachments. They are stored as BLOBs in an Image column in the legacy database. After several fruitless exp...

SQL GROUP BY CASE statement with aggregate function

I have a column which looks something like this: CASE WHEN col1 > col2 THEN SUM(col3*col4) ELSE 0 END AS some_product And I would like to put it in my GROUP BY clause, but this seems to cause problems because there is an aggregate function in column. Is there a way to GROUP BY a column alias such as some_product in this case,...

Sql Server: Implementing a multi-table search

I'm trying to figure out the best way to search a number of different tables for a simple term. I have two solutions in mind 1) Create a "Search table" with the following structure and create triggers on the tables I would like to search to enter the information into the search table ID || String to check against || ...

How to tell what temporary tables are currently in scope in SQL Server?

I often get the errors: Msg 208, Level 16, State 0, Line 1 Invalid object name '#foo'. Msg 3701, Level 11, State 5, Line 1 Cannot drop the table '#foo', because it does not exist in the system catalog. How do I know what temporary tables there are in scope? They obviosly don't show up in SSMS like base tables do. ...

Oracle Gotchas for An Experienced Newb

What are some Oracle gotchas for someone new to the platform, but not new to relational databases (MySQL, MS SQL Server, Postgres, etc.) in general. Two examples of the kind of things I'm looking for Many relational database products handle creating an auto_increment key for you. Oracle does not, you must manually create the sequence...

How to edit a raw table, showing a foreign key value as reference

I have a simple table for a gallery. There are many galleries, each containing images - which may belong to multiple galleries. Basically this is a 'cross table' with a sort order within that gallery. CREATE TABLE [dbo].[GalleryXGalleryImage]( [GalleryId] [int] NOT NULL, [GalleryImageId] [int] NOT NULL, [SortOrder] [int] NO...

What represents a double in sql server?

I have a couple of properties in c# which are doubles and I want to store these in a table in sql server, but noticed there is no double type, so what is best to use, decimal or float? This will store latitude and longitude values, so I need the most accurate precision. Thanks for the responses so far. ...

Reporting in Rich Text

I've built an ASP.net web application which allows the users to view and make notes on a list of calendar events. The notes are edited in a WYSIWYG editor that outputs to HTML text (but could also output to RTF), which is then saved as text in an MSSQL05 database. Now I've got to add a printing function to the calendar application. Pr...

Get last record for each date from a table

I have a table that logs inventory updates throughout the day. Table InventoryHistory: UpdateID INT IDENTITY ProductID INT UpdateDateTime DATETIME QuantityOnHand INT Sample records: 1, 1, '7/29/2009 9:00', 100 2, 1, '7/29/2009 14:00', 99 3, 1, '7/29/2009 20:00', 98 4, 1, '7/30/2009 9:00', 97 For a given ProductID, I need to get a ...

How to retrieve rows multiple times in SQL Server?

These are my rows that I initially retrieved: 112 Cem Ceminay 210 Ali Salih 132 Gül Sen Now I want to clone every row to be duplicated as 3 rows. So the new results: 112 Cem Ceminay 112 Cem Ceminay 112 Cem Ceminay 210 Ali Salih 210 Ali Salih 210 Ali Salih 132 Gül Sen 132 Gül Sen 132 Gül ...

Adding C# web app to a web site with IIS6

I finished my very first C# project in VS 2008 and it is working well now. But now I need to publish this project onto my new website. This project is a web application that interacts with my SQL Server 2008 Adventureworks database on this same computer(XP Professional OS). I am running IIS 6.0 Manager, but I am a newbie to both IIS 6.0 ...

Getting a new connection from the connection pool times out in ASP.Net application. I need suggestions for mitigation

We are getting the following error on a certain database occasionally under moderate load. "System.InvalidOperationException: Timeout expired. The timeout period elapsed prior to obtaining a connection from the pool. This may have occurred because all pooled connections were in use and max pool size was reached." I have combed through ...

sql command for reading all columns in the first row

Dear All I am an SQL newbie, I am having an excel sheet in which the first row contains title for all the columns. I want to all the names in the first row. Question What is the SQL command for - reading all the entries in the first row? If possible, I want to define the max-limit. Addition: What I want is, "Enumerate all the column...

How to display arabic characters in web page using php and sql server

How can I display Arabic characters in web page using php and sql server? The Arabic data is stored in the database (sql server). Now I want to use php to display that data on the web page. How can I do this? ...