sql-server

In SQL Server 2005, what is the difference between len() and datalength()?

What is the difference between len() and datalength() in SQL Server 2005? ...

how to access sql server from asp page

We have a legacy, homegrown timesheet system (ASP, microsoft sql server 2005) that I need to clone to another computer for backup purposes. (I know very little about this stuff, so pleas be gentle) I've got most of the pieces in place (IIS, Sql Server, table import / creation). But, the ASP page to access the timesheet pages is choking ...

Numbering comments in ASP.NET and MSSQL

I've just thought about best way to store comments in database with appropriate numbers according to the article. The idea is to store comments with composite primary key (commentId, articleId) where commentId is generated according to the given articleId. The system of generating should has same principle as IDENTITY generated columns ...

Best way to pass a connection object among forms?

Background: I'm rewriting a VB6 app that used MS Access for data storage to one that uses VB.NET and MS SQL Server. I'm curious as to the best way to pass a connection among the different forms in my application that need a connection to the database. Right now I've built a class to manage the connection string to pass that between f...

Fedora 8 howto rebuild custom PHP?

Hello, I am running a wiki server for my group at work and recently moved it to a Fedora 8 OS. Everything works great except that an extension I wrote that contacts an MsSql server fails because the function mssql_connect is not there. On my old server I used "Free TDS" (with ./configure --prefix=/usr/local/freetds --enable-msdblib) an...

Why am I getting a multi-part identifier error in SQL?

There are some tables that we want to do a search I couldn't understand why this error happens , please help I should be easy for experts , SELECT * FROM passenger INNER JOIN [passenger-flylist] ppff ON ppp.[passenger-id] = ppff.[passenger-id] the Error : Msg 4104, Level 16, State 1, Line 1 The multi-part identifier "ppp.passenger-i...

How to get a list of fields in a unique constraint

I have a table with a unique constraint on one or more fields. Given the constraint name, I want to query the system views to get the list of fields that are part of this constraint. SQL Server 2005. Thanks. ...

SQL query to return top N rows per ID across a range of IDs

Lets say I have a table containing several hundred million rows that looks something like this: memID | foo | bar | foobar 1 | blah | blah | blah 1 | blah | blah | blah 1 | blah | blah | blah 1 | blah | blah | blah 1 | blah | blah | blah 1 | blah | blah | blah 1 | blah | blah | blah 2 | blah | blah | bl...

Coding stored procedure for search screen with multiple, optional criteria

I've got a search screen on which the user can specify any combination of first name, last name, semester, or course. I'm not sure how to optimally code the SQL Server 2005 stored procedure to handle these potentially optional parameters. What's the most efficient way? Separate procedures for each combination? Taking the items in as null...

SQL Convert float to comma varchar with decimals

I have a couple floats that are kinda big. They're around a 100 million. I would like this number to show like the following 123,456,789.01234 I've found that I can use CONVERT if its a money datatype but this doesn't do the full trick (it leaves off some decimal places). I have to have commas on the left and five decimal places on th...

What is a maintainable way to store large text fields without sacrificing performance?

I have been dancing around this issue for awhile but it keeps coming up. We have a system and our may of our tables start with a description that is originally stored as an NVARCHAR(150) and I then we get a ticket asking to expand the field size to 250, then 1000 etc, etc... This cycle is repeated on ever "note" field and/or "descriptio...

NHibernate - SELECT DISTINCT equivalent for a page filter - Northwind

Lets say you are working in SQL 2005 with a copy of Northwind database installed. Your working on an ASP.NET application with an Employees "browse" page. At the top of the page you have a "Title" filter where you would like to display these 5 choices in a dropdown: [ALL] Vice President, Sales Sales Representative Sales Manager ...

SQL commands to get performance statistics

Are there SQL commands that I could use to extract performance monitoring data from MS SQL 2005, such as: transactions per second page reads/writes connections (@@CONNECTIONS gives the total, but what about current) physical reads locks and blocks other counters that might be interesting? ...

MS Access Application - Convert data storage from Access to SQL Server

Bear in mind here, I am not an Access guru. I am proficient with SQL Server and .Net framework. Here is my situation: A very large MS Access 2007 application was built for my company by a contractor. The application has been split into two tiers BY ACCESS; there is a front end portion that holds all of the Ms Access forms, and then on ...

Create a GeoServer feature using a SQL Server 2008 View

We are trying to create a feature (layer) in GeoServer on top of a view in SQL Server 2008, rather than a table. We are able to create the feature, but it won't display any data because GeoServer (JDBC) can't detect a primary key to use as the FID. To the best of my knowledge, it is not possible to make a view column appear to be a prima...

How to create trigger

i'm using a sql server 2000. My Tree structured table is here tItem ItemID int keyfield, ParentItemID int, Title nvarchar 200, ChildCount int, Status int I need to calculate ChildCount and Status trigger. When i insert one item, parent item must calculate child count and status. 0 < status < 100 Calculate parent statu...

ExecuteScalar gives NullReferenceException

Please look at this code when it goes for ExecuteScalar it gives an error : NullReferenceException I tested it inside sql server and it worked selectedPassengerID = 0; //SqlCommand command = GenericDataAccess.CreateCommand(); // 2nd test string connectionString = ""; SqlConnection conn; ...

Microsoft SQL Server 2008 External Backup

Hi, I would like to save my backups from my SQL 2008 server to another server location. We have 2 servers: Deployment server File Server The problem is that the deployment server doesn't have much space. And we keep 10 days backups of our databases. Therefore we need to store our backups on an external "file server". The problem is ...

Performance of data

I have 60 columns in a table. 1). I want to add one more column to that table. Will there be any impact on performance? 2). How many columns can I add? 3). any idea for the avoid recursion. [I have no idea here - annakata] ...

How do I handle long comparisons in SQL

I have a pathological issue with SQL, so I usually sort all of my database issues by building quickie software applications to handle my SQL problems. (as I am also doing in this case) Thanks to StackOverflow I think I can be shamed into correctness, so I would like to learn how to make this kind of SQL troubleshooting in actual SQL o...