sql-server

How do you cycle (close the existing and start a new) errorlog on SQL Server?

How do you cycle (close the existing and start a new) errorlog on SQL Server? ...

Time Based Events in ASP.net

I need to perform some events (sending emails, etc.) based on time. What is the best way to accomplish this in ASP.net in a hosted (medium trust) environment? ex: Send email every day at 4:00pm. ex: Send email after 15min of login. ex: Send email after 10 hrs of last change to status. The triggering logic can be complex on some of ...

Been a LAMP developer for years, now transitioning to the Microsoft Web Stack. Where do I begin?

I've always worked with the standard Linux web stack (linux, apache, php, python, mysql) but have been given a great job opportunity working with a group that works with the Microsoft Web Stack (IIS, ASP.NET, MSSQL, C#). There seems to be a pretty good Microsoft following here on SO. Where should I begin? Specific books, tutorials, on...

Easy database userface

I have a simple SQL Server database that we use for conversions. Basically a table with two mor more columns where one value maps to another. We then have processes that use these tables to find matching values and select other values on that row. These values change a lot and we now need a interface for the business users to update the...

Combine Multiple Fields into One Text Field in SQL Server

So I have a table that looks like this: Name ID TaskID HoursAssigned ---------------------------------------------------------------- John Smith 4592 A01 40 Matthew Jones 2863 A01 20 Jake Adams 1182 A01 100 Matth...

How to have a "master-structure" database with "children-data" databases in SQL SERVER 2005???

I have been googling a lot and I couldn't find if this even exists or I'm asking for some magic =P Ok, so here's the deal. I need to have a way to create a "master-structured" database which will only contain the schemas, structures, tables, store procedures, udfs, etc, everything but real data in SQL SERVER 2005 (if this is available ...

SQL 2005 performance: column order when mixing varchars with int types

I have a table like this: create table SomeTable ( tableKey int identity(1,1) not null , foreignKey int not null , longDesc nvarchar(max) not null , shortName varchar(100) null ) I need to use shortName in a where clause: select tableKey from SomeTable where foreignKey = @foreign...

using pyodbc on linux to insert unicode or utf-8 chars in a nvarchar mssql field

I am using Ubuntu 9.04 I have installed the following package versions: unixodbc and unixodbc-dev: 2.2.11-16build3 tdsodbc: 0.82-4 libsybdb5: 0.82-4 freetds-common and freetds-dev: 0.82-4 I have configured /etc/unixodbc.ini like this: [FreeTDS] Description = TDS driver (Sybase/MS SQL) Driver = /usr/lib/odbc/libt...

What is the appropriate output file from T-SQL query of table that has XML as datatype

I created a batch script that calls a T-SQL file and output it to text file. The T-SQL file contains select statement of a table to get the information of column with XML as datatype. The file will then be sent with either contents as body of email or as an attachment. However, when I open the text file, I see a long list of information ...

Multiple Column Pivot in T-SQL

I am working with a table where there are multiple rows that I need pivoted into columns. So the pivot is the perfect solution for this, and works well when all I need is one field. I am needing to return several fields based upon the pivot. Here is the pseudo code with specifics stripped out: SELECT field1, [1], [2], [3], [4] F...

Aggregate Function not available as Article in Merge Rep Publication

I have Merge Replication set up and I just noticed that a Aggregate Function is not available on my Subscriber. After further investigation I discovered that is is not even available in the Publication as an option. There are other Functions listed there but not that one. Ideas? Is there something written that doesn't allow Aggregate...

Reporting Services Subscriptions won't allow modification of the To: Field

I have a little issue that is causing me a headache. Our Report Server is SQL Ent 2008 on a Win 2008 server. When users that have Report Browser permissions try to set up a report subscription the To: field is grayed out and pre-populated with their username. They cannot change this and it won't deliver to their email address which wo...

Saving Dates in SQLServer

hey guys I have a legacy application where the input is a date string, i.e.: 06/12/2009 The format of the input is always a string, and is consistent, it's always dd/mm/yyyy At the moment the legacy app just INSERTS this in a DateTime fields. Obviously if the Localization Culture settings of the Server change, we have a bug. Two...

Index performance

I have a table called Transactions with the following schema: ColumnName DataType Constraints ---------- ---------- ----------- id int PK (Cluster-Index) details varchar(50) Later on, I add the following two columns to this table: ColumnName DataType Cons...

Index Maintenance

What is Index Maintenance and how do I do it? How frequently do I have to do it? What are the benefits? This is related to a transaction table which is subject to frequently modifications; all DML operations will be run on that table. ...

suggest a query to in sql to find the unused tables

SNAHi anyone please suggest a query in sql to find the unused tables. I have a legacy application migrated to .net from coldfusion.But lots of tables are unused now What is the best way to find all the unused objects from database. (sql 2005) thanks SNA ...

Connect SharePoint web parts to a database

How do I connect a SharePoint web part to a SQL Server database? ...

SQL Collapse sequential time series sets together

In MSSQL I have a set of tasks which have start and end times. What I wish to do is collapse sequential tasks together. So my definition of sequential is TaskEndDate equals start of next TaskStartDate, there is no gap in time. In the below dataset, 21:00 to 21:40 is one sequence, then 22:00 to 22:20 & 23:20 to 00:00. TaskStartDate ...

saving a result from a tsql function in a stored procedure

Hi, I am having problems with a stored procedure that I am writing for SQL Server. I am calling a function within the stored procedure which returns a 2 column table with a value. This value I want to assign to a VARCHAR variable to be used throught the rest of my store procedure. DECLARE @TEAM VARCHAR(100) SET @TEAM = (SELECT DISTI...

Sql 2008 Collation

What Collation should I choose for my Sql 2008 setup? The setup is for an international company and Textual Data is Unicode. Default settings is based on Danish Locale PC. ...