Archived Months
January 2003
March 2003
April 2003
May 2003
June 2003
July 2003
August 2003
September 2003
October 2003
November 2003
December 2003
January 2004
February 2004
March 2004
April 2004
May 2004
June 2004
July 2004
August 2004
September 2004
October 2004
November 2004
December 2004
January 2005
February 2005
March 2005
April 2005
May 2005
June 2005
July 2005
August 2005
September 2005
October 2005
November 2005
December 2005
January 2006
February 2006
March 2006
April 2006
May 2006
June 2006
July 2006
August 2006
September 2006
October 2006
November 2006
December 2006
January 2007
February 2007
March 2007
April 2007
May 2007
June 2007
July 2007
August 2007
September 2007
October 2007
November 2007
April 2008
all groups > sql server programming > october 2006 > threads for wednesday october 4

Filter by Day: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31

weighted SELECT
Posted by spitapps at 10/4/2006 11:16:24 PM
I have 2 criteria(input from a user) to be searched for in a database, each criteria will be weighted (e.g 25/75, 50/50). So i was wondering if there is someone way to capture this in a SELECT statement?? Thanks, Kyle ...more >>


Hardware Tuning for Queries
Posted by Leila at 10/4/2006 10:07:24 PM
Hi, I have several queries in a complicated database that join almost 10 tables each. The query plans are good because there are a lot of index seeks and merge/loop joins (Hash join have been eliminated by appropriate indexes). It seems it doesn't lack any index. But as an example, a particul...more >>

dbcc messages
Posted by Keith G Hicks at 10/4/2006 8:41:19 PM
If I run EXEC sp_MSforeachtable 'DBCC DBREINDEX ("?")' in QA I get messages indicating the results of each table that's reindexed. If I run the same code from an exe how can I get at those messages to either log them in a text file or display them to the user? Thanks, Keith ...more >>

login - trusted connection
Posted by WCM at 10/4/2006 8:41:02 PM
Friends, Using T-SQL in QA I have added a new user (NewUser), login, and pwd. I also added a role and added NewUser to that role. Finally, I granted SELECT on Table1 to that role. But when I try to connect to SQL Server through QA using the new login and pwd, I get error message 18452, ...more >>

T-SQL vs. CLR/C# in SQL Server 2005
Posted by Tom Winans at 10/4/2006 7:33:01 PM
Has anyone tried to use C# or another .NET language as the primary database programming language? What I have seen regarding performance is that C# stored procedures perform at least twice as slow as their T-SQL equivalents. I've ensured that test cases are simple (e.g., select newid()) wra...more >>

C++ ADO Parameters problem
Posted by Jin Kwasthou at 10/4/2006 5:35:14 PM
Hi, I'm having a problem with ADO using C++, can anyone help? The code is as follows: _CommandPtr cmd; cmd.CreateInstance(__uuidof(Command)); cmd->ActiveConnection = con; // con is the connection set up earlier cmd->CommandType = adCmdText; cmd->CommandText = "declare @sys_key va...more >>

modelling many to many relationship
Posted by modhak NO[at]SPAM gmail.com at 10/4/2006 4:19:23 PM
Hi All I have a table like this CREATE TABLE dbo.employee ( empid int identity primary key, empname varchar(50) ); I have to model where employee has subordinates and he can be subordinate to others. My problem is each employee can be reporting to many reporting to many employees. ...more >>

return table function(s)
Posted by WebBuilder451 at 10/4/2006 3:04:02 PM
I need to return a table of numbers based on a given increment. i will accept a variable that will be a percentage (example 0.02 or 2 percent) i want to return 300 rows of numbers starting at 0.01 and adding the input percentage to the previouos value. ID, value 0.01 1, 0.0102 ...more >>



Multiple values in a parameter to an SP in SQL2005
Posted by boblotz2001 at 10/4/2006 2:45:37 PM
Has anything new been introduced in SQL Server 2005 to handle multiple values passed into a Stored Procedure or do we have to jump through the same hoops as in 2000? Something like: CREATE PROCEDURE test (@a varchar(100)) AS BEGIN SELECT f1 FROM table1 JOIN string_to_table(@a) a ON tab...more >>

CLR function that references another assembly
Posted by vwemil at 10/4/2006 2:39:02 PM
Hello, I am trying to create CLR table valued function using third party assembly(.dll) developed in .NET 1.1 and I cannot figure out how to add reference to it in VS 2005 database project. I have: 1.Added reference path to the .dll in the project properties 2.Registered .dll in the GAC. ...more >>

Extensible database design?
Posted by William Sullivan at 10/4/2006 1:33:01 PM
I'm looking at designing a database that can be easily extended by users to track additional data. For instance, extending a user's profile to track the number of children. I can see three ways to do this. First, allow users to make modifications to the database structure through my progr...more >>

html in xp_sendmail
Posted by Tony Hedge at 10/4/2006 1:30:02 PM
Hello, I have xp_sendmail working fine from inside my stored procedure, however now I would like to have the text marked up with html tags. When I add the tags, they appear as plain old text in the message when I receive it. How can I accomplish getting the text to be recognized as HTML in...more >>

Using BLOB in SQL 2005
Posted by imarchenko at 10/4/2006 1:27:10 PM
Hello! I am doing initial research on usage of BLOB datatypes in SQL Server 2005. I was wondering if anyone can tell me what major improvements have been made in terms of performance, easy of use in regards to BLOB data types in SQL Server 2005. Will it be more efficient to use other al...more >>

stored procedures
Posted by Rob T at 10/4/2006 1:11:30 PM
Is it possible, if so, how do you exec a SP and have the results from it be usable so it could be joined into another table? Even if I have to store the results into a temp table first is fine..... ...more >>

Evaluate variable with len
Posted by JR at 10/4/2006 12:52:07 PM
I have the below code which is part of a larger piece of code that the @col_name variable holds the name of each column in a table. Problem is, the len and max values are evaluating the column name, not the column data itself. DECLARE @col_name varchar(100) select max(len((@col_name))) from ...more >>

SQL Query over two servers?..
Posted by ibiza at 10/4/2006 12:49:58 PM
Hi all, I have this problem : I have two Servers with SQL Server 2005 : one dev and one prod. I'd like to do the following : Update my table 'Titles' on prod so that it insert any row not found on prod but that appears on dev. Something like : INSERT prod.Titles SELECT * FROM dev.Titles WH...more >>

include columns in group by query
Posted by John A Grandy at 10/4/2006 11:52:28 AM
I have a table of items where it is possible that various groups of items have identical name and description. I want my select query to return a single representative item for each group of such items. So I run a job that creates an itemHash column for each item (itemHash is based on item...more >>

T-SQL Syntax Error
Posted by Jason Wilson at 10/4/2006 11:27:12 AM
I can't seem to figure out my syntax error in the following SP: /* Stored Procedure that will assign RadReports to a coder and log the event in the event history -- Jason Wilson 10/4/2006 */ CREATE PROC PR_AssignReport @Coder varchar(36) AS BEGIN --** Find Place Of Service, Patien...more >>

Duplicate Records After Join
Posted by Pancho at 10/4/2006 11:19:02 AM
Hello, I run a nightly query that produces a table called CJN_BUCKET2. It contained 22 records today. When I execute the following joins I pick up 1 extra row after the first join and 2 extra rows after the second join, resulting in an employee having 2 or 3 identical rows that I then have ...more >>

cross platform & encryption
Posted by Blasting Cap at 10/4/2006 11:01:56 AM
I have a web app that will be an online store. As part of a user's profile, they have their credit card stored on our system. The app is using SecurityLib as the data encryption tool. However, what has to happen on the back end of this application, is that another platform (SAP) has to re...more >>

choosing data type
Posted by JJ at 10/4/2006 10:08:44 AM
Just curious about your opinions. I have a column that will store characters. The varibility of the length of the data is small (it could be between 2-5 characters but no more than 5). Would you use varchar(5) or char(5)? What factors do i need to consider? Thanks all ...more >>

Cursor Question
Posted by Bahman at 10/4/2006 10:03:01 AM
Hi! In the sample code: -------------------------------------- OPEN Employee_Cursor; FETCH NEXT FROM Employee_Cursor; WHILE @@FETCH_STATUS = 0 BEGIN FETCH NEXT FROM Employee_Cursor END; .... -------------------------------------- is it possible to not have two FETCH statements a...more >>

Easy way to deploy UDT to user database and tempdb
Posted by Andy in S. Jersey at 10/4/2006 9:45:01 AM
I need to deploy my UDT to my user database and the tempdb database because I need to create temporary tables that have the UDT as a column. I am having trouble with that manual technique. But, from within Visual Studio I am able to deploy to my user database easily, and can deploy to temp...more >>

Extracting full contents of a varchar column
Posted by wnfisba at 10/4/2006 9:34:02 AM
I am using SQL Query Analyzer to select a couple of columns...one of them being a varchar 1500 column. Within SQL Query Analyzer, the text is cutting off at a certain point and I want to be able to bring the data into an Excel spreadsheet and compare it with some other data I have utilizing an...more >>

Cross Tab Query?
Posted by Rob T at 10/4/2006 9:22:40 AM
I have a query that return the following results: ItemNum ShortName RecData CD Cap 23 CD Volt 120/240 CD UL yes Is there a way to twist the data around so it would look like this?: ItemNum Cap Volt UL CD 23 120/2...more >>

Help using IF statement in WHERE clause
Posted by aljamala NO[at]SPAM gmail.com at 10/4/2006 9:17:54 AM
Hi, I have a stored procedure that looks like the following... CREATE PROCEDURE dbo.p_sel_RateMatrix_Factors @pgm_type varchar(20), @n5 varchar(20), @sec_adv_opt varchar(10), @sec_adv_num varchar(10) AS SELECT rm_rate_factor, rm_sec_dep, rm_adv_pay, rm_sec_dep, rm_cost_lower, rm_cost...more >>

XML datatype, SQL Server, and DB Web Service
Posted by Tom Winans at 10/4/2006 8:20:02 AM
WSDL.exe generates a proxy that includes a class "xml", a class that wrappers an array of XML Nodes that is used to communicate XML data to a database web service that requires an XML input parameter. Question: How does one structure this array of nodes for a complex XML document? Breadth ...more >>

SELECT INTO FROM......
Posted by Kjell Brandes at 10/4/2006 7:59:02 AM
Hi all, Im trying to select data from a database via OpenQuery (ODBC, Progress), When doing this I get an error indicating that data in a column formatted as datetime i wrong so query fails. Is there a way to do selects with option like "On error resume next"? I want to skip the value settin...more >>

Database Role Issue
Posted by UnglueD at 10/4/2006 7:56:29 AM
Hello, I have recently restored a database on a test server from a backup of a production server. I did this to basically update the test with the production data. I chose to do this over a simple import/export data package because I wanted to choose the objects I was bringing over. M...more >>

DBA Trainign Track
Posted by wnfisba at 10/4/2006 7:28:02 AM
I would like to put myself on a SQL DBA track. I am currently a Programmer/Analyst within the SQL Server world and would like to take the next step into becoming more technical. Can anyone out there suggest some courses or training that I might be able to take that would me to get on this t...more >>

insert records into a file based on a query in Visual Basic
Posted by KL at 10/4/2006 7:20:36 AM
I need to Write into a file in Visual Basic. Have to open the file and the contents of the file are based on a SQL query. How is this possible? ...more >>

Query Assistance
Posted by Jeff at 10/4/2006 6:56:02 AM
I need a query that returns only the last/lates (most current) by date for a computname. Table TableID, Computername, IPAddress, Date_Time Data: 1, computer01, 192.200.130.100, 10/01/2006 09:00:00 2, computer 01, 192.200.130.100, 10/03/2006 08:30:00 3, computer02, 192.200.130.200, 09/3...more >>

Query Help
Posted by Jeff Ericson at 10/4/2006 6:53:02 AM
I have two tables, a document table and a pages table. I have a query(below) that joins them together and a sub query used to limit the 2nd table to the minimum page number. I need to get the sourceid field from the page table for the minimum page for each document. The problem is that quer...more >>

Rolling Averages
Posted by Chris at 10/4/2006 6:42:03 AM
Greetings, all. I am trying to get a rolling average of turnaround times. For graphing purposes, I would prefer to have this automated. I would like to have the rolling average for the last 7 days. For instance, today I would have the average turnaround time for days 0 through 7. For yes...more >>

insert records into a file based on a query
Posted by KL at 10/4/2006 6:41:59 AM
I have a SQL SERVER query. I can also save this query as a stored procedure. Based on this query the result has to be written into a text file. How do I go about starting this. Any ideas Pls? ...more >>

Design pattern for batch processing of 1000s of search criteria
Posted by Joseph George at 10/4/2006 6:09:05 AM
Hi, I'm looking for a design pattern (preferably leveraging SQL Server 2005 features) to create a batch job which will process 1000s of different user-defined search criteria against a large DW. The data warehouse schema is classical star schema in a healthcare setting: Claims, BillLines, D...more >>

SQL Management Object Question
Posted by Catadmin at 10/4/2006 5:19:02 AM
Hopefully someone knows the answer to this. The SQL Management Object (SMO) is usually coded in Visual Studio .Net, but the only examples I have of it from my "Upgrade Skills to SQL 2005" class are in VB .Net. Does anyone know if this can be coded in C #? Our company is becoming a C # ....more >>

Issues after Moving DB
Posted by Andy at 10/4/2006 4:48:02 AM
Hi We've moved a copy of our live database to our dev server for testing, ranaming it to TEST on the way. We now get the message Could not find server 'ABC' in sysservers. Execute sp_addlinkedserver to add the server to sysservers. ABC is the name of the LIVE server. We also do not use or...more >>

adding strings and passing as arguments
Posted by adam at 10/4/2006 12:00:00 AM
Sorry for being dense but I can't find any info on this. Do I have to do all string concatenation into a single variable before passing the value to a stored proc, Or is there another syntax. This is what seems natural (From sample code below) exec dbo.test_proc @s1 + @s2 Thank you for ...more >>

Deadlock involving delete and insert
Posted by Roshan N.A. Jayalath at 10/4/2006 12:00:00 AM
HI All, I have a deadlock which Im unable to simulate or get a trace. So what I require are the steps which you think would cause the deadlock. One of the transactions participating in the deadlock does the below. DELETE FROM Table1 WHERE X = 1 AND Y = 2 INSERT INTO Table1 (X, Y, Z) VAL...more >>


DevelopmentNow Blog