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 > march 2006 > threads for tuesday march 14

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

DB_E_ERRORSINCOMMAND ( HRESULT = -2147217900 )
Posted by Vodafone at 3/14/2006 10:42:55 PM
Hai all, I am getting an DB_E_ERRORSINCOMMAND exception when I try to open a recordset or execute query in VC++. But when I run the same query in Query Analyzer, it is working fine. I am sure the connection string is correct. I am running a collection of queries and finally commit the tran...more >>


how to check whether the sql server is up
Posted by vipinhari NO[at]SPAM gmail.com at 3/14/2006 10:00:49 PM
hi, i'm working on a windows service in vb.net which will be started automatically. but sometimes, on startup, it will show this error -- ERROR [08001] [Microsoft][ODBC SQL Server Driver][Shared Memory]SQL Server does not exist or access denied. I think this is because, my service uses an...more >>

Composite index design question
Posted by mikenz at 3/14/2006 9:39:27 PM
I have converted a database to support multiple clients by adding a ClientID (int) to most of the 200 tables. This is to enable an application to use a single database for multiple clients, separating the data via the ClientID Where the primary key was OrderID, or ProductID, it is now ( Clie...more >>

database design:dnamically build where clause
Posted by cooltech77 at 3/14/2006 8:37:20 PM
Hi I am creating a table to store metadata information for certain technical parameters which are stored in various tables. These parameters have various criteria to determine if they are compliant to certain predefined conditions or not.I will explain with an example: For ex, paramA is...more >>

Stored prodedure OUTPUT parameter
Posted by b_r at 3/14/2006 8:32:07 PM
Hi, I have one stored procedure (SQL Server 2005 Express) with OUTPUT parameter. Table consists of two columns ArtistID (autoincremrnt) and ArtistName. The problem is that when I execute the code I have to assign number to @AID, but this is value which should be returned by the procedure. ...more >>

Group by weekends
Posted by FJC at 3/14/2006 7:55:27 PM
Does anyone know how to group by weekends?...more >>

How to set sql server setting let to set null value when a empty string (zero length) set to column?
Posted by ABC at 3/14/2006 7:48:10 PM
How to set sql server setting let to set null value when a empty string (zero length) set to column? I want it automatic to set null value when maintain data is a zero-length string press to column of table. for example, when a statement as "Insert into table1 values ('abc', '', '')' beco...more >>

Join table with a UDF?
Posted by Ishan Bhalla at 3/14/2006 5:29:40 PM
Hello all, I have a UDF that returns a few fields. The UDF accepts a 'ConnoteId' and returns a table containing 4 fields including the same 'connoteId'. I want to be able to join this table to the connote table and be able to pass a connoteId to the UDF. Essentially something like thi...more >>



can't update table owned by dbo with impersonation account
Posted by ASP Developer at 3/14/2006 5:00:27 PM
I am using an impersonation account to execute a procedure via executenonquery in asp.net. If the table owner is dbo I get the following error in .net: input string was not in a correct format. When I step through my code it actually is saying that permission is denied on the table. I'...more >>

Question about error handler
Posted by Iter at 3/14/2006 3:44:27 PM
In store procedure, when a statement has error and Severity is high, so eror is occured and stop the stored procedure and exit the sp. So I cannot use @@error to catch the error. Is there any way that I can proceed the sp and don't let it stoped so that I can use @@error to catch the error and...more >>

Call a Dll from Stored Procedure
Posted by tshad at 3/14/2006 2:42:53 PM
Can you call a .dll from a stored procedure? I am looking to use this as a trigger to run some other software. I have a piece of software that I was going to run as a service when a record is updated. But I have no way to trigger the service that something has happened. For example: ...more >>

How to make argument/parameter optional in UDF/Trigger?
Posted by Rich at 3/14/2006 2:34:23 PM
Hello, I took over a project, and I need to make updates, modifications, pick up where the last person left off. There is one table that is used in several processess from external apps. This table contains an InsteadOf trigger that I need to disable for just one new procedure that am ad...more >>

Turkish characters are not displayed correctly on production server
Posted by Burak Kadirbeyoglu at 3/14/2006 2:29:11 PM
Dear SQL Server Programmers, I have a problem with Turkish characters. On my development server (Windows Server 2003) SQL Server 2000 is installed with SQL_Latin1_General_CP1_CI_AS server collation. The collation of the database is also SQL_Latin1_General_CP1_CI_AS. My .NET web application ...more >>

how to create function which eval expression
Posted by Kevin at 3/14/2006 2:28:25 PM
hi all, I would like to create a function which can eval string expressiion select dbo.fn_eval_string('1+2+3') return 6 and if I do dbo.fn_eval_string('2-(5-3)') return 0 is that possible? it should also support multiply and division. ...more >>

sp_OAMethod Returns Empty String
Posted by Eric at 3/14/2006 2:09:28 PM
I'm trying to access a method from a VB dll. Here's what it looks like: Public Function Encrypt(ByVal Account As String) As String Dim cryptor As Object Set cryptor = CreateObject("Activecrypt.RSACrypt") cryptor.Async = False PublicKeyString = cryptor.LoadKey("publick...more >>

How can I use stored procedure's recordset output into simple SELECT statement?
Posted by Nayan Mansinha at 3/14/2006 2:05:50 PM
Hi All I have one stored procedure called MY_SP that returns a recordset. I would like to use this recordset output into my SELECT statement like this: SELECT * FROM (EXEC MY_SP '1', '2') RS The above blurs up with syntax error at EXEC. Is there a way to achieve this? (Note that MY_S...more >>

Pick TOP 1 row per GROUP BY group
Posted by daga at 3/14/2006 1:53:28 PM
Hello I would like to write a SQL statement to return the TOP 1 row in each group of rows created with GROUP BY. Based on the following data table: CREATE TABLE [RDGeo].[tblPostalCode]( [PostalCodeID] [nchar](10) NOT NULL, [CountryID] [int] NOT NULL, [CountyID] [nchar](10) NULL, [Mu...more >>

Migrating to SQL Server!
Posted by MIK at 3/14/2006 12:42:33 PM
Hi, My application is currently running with an Oracle database at backend but now I want to deploy it with MS SQL Server for a client. Can anybody tell me what I should do? I am very new with SQL Server. My application uses sequences that I cant find in SQL Server commands list etc. pleas...more >>

Can I build WHERE clause dynamically in a Stored Procedure in SQL Server 2005?
Posted by Learner at 3/14/2006 12:30:32 PM
Hello, I am using SQL Server 2005 and I am just wondering if I can build the WHERE clause dynamically. I only want to build WHERE class if the my @VIN count is of exactly 17 charecters. Here is my code ************************************************* set ANSI_NULLS ON set QUOTED_IDENTIFIER ON...more >>

combine data in one row?
Posted by Test Test at 3/14/2006 12:28:38 PM
I need to display data in such a way that one row represents one Id. In other words, I need to combine multiple rows data, separated by commas, per each Id. create table #temp (a int, b varchar(20)) insert into #temp values (1, 'green') insert into #temp values (1, 'blue') insert into...more >>

How to copy a table including all constraints,... to same database
Posted by Rich at 3/14/2006 12:23:27 PM
Hello, Is it possible to copy a table to a new table in the same database? to include all constraints, keys, triggers? I noticed in the dropdown menu in Enterpirse Manager when I right-click on a table there is a Copy selection but no paste selection. I appologize in advance if I sound a...more >>

Newbie Select Problem
Posted by BenHue at 3/14/2006 12:21:29 PM
Is there a way to select just one record when comparing a field? ex: VisitID Surgeon ... 11221 900123 11221 900999 .... I would only want the first ID to show up. The record only differs by one field, namely the Surgeon field in the above example. T...more >>

Dynamic Where clause
Posted by gdjoshua at 3/14/2006 11:55:34 AM
I need to build a dynamic where clause. Somehow I can't get it to work. Here's the stored procedure. I believe I'm not concat. the @WhereOrderByClause parameter correct? Does anybody have any idea's??? Joshua set ANSI_NULLS ON set QUOTED_IDENTIFIER ON go -- ==============...more >>

query
Posted by ichor at 3/14/2006 11:40:33 AM
drop table share create table share ( shid int identity , dt datetime, price int ) insert into share(dt,price) values('1-jan-2006',10) insert into share(dt,price) values('2-jan-2006',11) insert into share(dt,price) values('6-jan-2006',15) insert into share(dt,price) values('4-jan-2006'...more >>

Truncating vs. Rounding
Posted by Ottar Holstad at 3/14/2006 11:35:52 AM
Hi, I'm having a problem where SQL Server (at least SQL Server 2005 and MSDE 2000) is truncating numbers where I would have thought it should do a rounding. The field in question is declared as numeric(13,0), and the value is 79999.8. If I do the update in Enterprise Manager or Management Stud...more >>

Static variable in SQL procedure ?
Posted by pb_boy_6 NO[at]SPAM yahoo.com at 3/14/2006 11:07:43 AM
Hi- I am trying to write a SQL procedure to do the following: Aggregate several rows (number is unknown) into a single row based on an ID field and aggregate the value of another field's values in a comma-delim list. Example: ID ------ Color 1 Blue 1 Yellow 1 ...more >>

ALTER TABLE ... IDENTITY question....
Posted by Stu at 3/14/2006 10:50:53 AM
Hi, I am trying to programatically change the seed of an existing IDENTITY column (Copy_ID). When I run the following command I get the error: Server: Msg 156, Level 15, State 1, Line 1 Incorrect syntax near the keyword 'IDENTITY'. ALTER TABLE Copy ALTER COLUMN Copy_ID Int IDENTITY (1,1)...more >>

about MSSQLSERVER run as LocalSystem
Posted by rate at 3/14/2006 10:43:12 AM
Hi,it is fail when I try to open a namedpipe of another machine in sql2000's extern storage procedure. WNetAddConnection2() return 1312 CreateFile() return -1 and GetLastError() return 5 MSSQLSERVER is running as LocalSystem. If MSSQLSERVER login using a user account, the extern storage p...more >>

SQL Server Agent
Posted by TAHA at 3/14/2006 10:40:39 AM
Hi All When I Change Sa password SQL Server Agent Can't Start Any id Thanks ...more >>

Maintanance job fails
Posted by Morten Snedker at 3/14/2006 10:29:31 AM
EXECUTE master.dbo.xp_sqlmaint N'-PlanID 95C0459D-8D08-478E-9058-41CA9D0A0F51 -Rpt "P:\SQLBackup\AllUserDB0.txt" -DelTxtRpt 2WEEKS -WriteHistory -RebldIdx 10 -RmUnusedSpace 50 10 ' results in www.planprojekt.dk/upload/maint.txt, where the end of the file states "SQLMAINT.EXE Process Exit Cod...more >>

A question of design
Posted by Chris Strug at 3/14/2006 10:12:45 AM
Hi, My apologies if this isn't strictly the right group but you've always been very helpful in the past so... I was wondering if there were any best practices with regards to the following scenario: Given a simple FK relationship (employees table to transaction table for example), is ...more >>

ex stored proc and COM objects
Posted by Tim Wallace at 3/14/2006 9:42:15 AM
Am I right in stating that I cannot create COM objects using ATL inside of an extended stored procedure? I have need to use an ADODB.Connection object to communicate with our LDAP. Originally we were just going to use sp_OACreate in a "regular" stored proc, but since we need to permit non-...more >>

Isolation Levels
Posted by skg at 3/14/2006 9:33:54 AM
Is setting SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED equivalent to doing reads with nolock.? e.g. select col1,col2 from t1(nolock) join t2 (nolock) .... equivalent to ... SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED select col1,col2 from t1 join t2 .... thx ...more >>

Rowcount reporting incorrectly...
Posted by isideveloper at 3/14/2006 9:15:18 AM
Why when I double click my table, does the "Rows" field show 10 records, but when I do a SELECT COUNT(id) it show me the right amount? SQL 2000 Enterprise, Windows 2003 I've run DBCC CHECKALLOC, UPDATEUSAGE, DBREPAIR, SHOWCONTIG, INDEXDEFRAG...etc. I've never heard of this before. ...more >>

Synchronizing data between sql 2000 and sql 2005
Posted by Arno Ham at 3/14/2006 8:42:58 AM
What’s the best way to synchronize data between a sql 2000 server and a sql 2005 server? I want to make a trigger that sends the data to sql 2005 when an application changes a row in sql 2000. We can’t change the sql 2000 server to sql 2005. Is this possible with a service broker, or is th...more >>

looping with SQL
Posted by Logger at 3/14/2006 8:38:26 AM
Hopefully this is a better explanation of what I tried to explain earlier. Below is an example of a dataset I build as a #wkfile. It consists of a count/identity, Company, AccountNo, and Title. I’m trying to loop thru with SQL to pull out one occurrence of Company Name and AccountNo, into...more >>

creating xml and passing it on.
Posted by Martin H. at 3/14/2006 8:21:29 AM
I'm rather new to xml in sql server 2000. So i searched around for a while, but i can't quite understand how should i make a stored procedure, that will create xml from a select clause and then pass it as an input parameter to another stored procedure? Basically i can't figure out how can ...more >>

problem with datepart ....
Posted by Xavier at 3/14/2006 8:10:28 AM
hello i have a table with date entries of type string ...tries of type varchar like 01.01.2006 ....... 01.02.2006 ....... 28.02.2006 print DATEPART(dw,'01.02.2006') ->2 print DATEPART(dw,'14.02.2006') -> Server: Msg 242, Level 16, State 3, Line 1 The conversion of a char da...more >>

What is the cost Sql Server incurs by using the SqlDependency class?
Posted by Simon Politakis at 3/14/2006 7:44:00 AM
Does anybody know how sql server tracks changes to the source data so it can notify the SqlDependency class on changes? I ran profiler and only saw the service broker message being queued, but not any query run by sql to detect changes. I would like use a SqlDependency to expire my caches but...more >>

Any way to avoid using a cursor for this?
Posted by Ian Boyd at 3/14/2006 7:25:39 AM
i want to convert a row history table into an audit log. A customer has a very wide table.. CREATE TABLE RepairOrder ( RONumber int PRIMARY KEY, --Look, a table, because it has a primary key *sigh* LocationCode varchar(10) NOT NULL, Model varchar(60) NULL, MfgCode varchar...more >>

Having problems getting stored procedure to work.
Posted by Terry Olsen at 3/14/2006 6:40:57 AM
I'm having trouble getting the following stored procedure to work. When I call it, I get 0 rows returned. I call it like so: EXEC RetrieveShipments 'City','Is','Omaha' or EXEC RetrieveShipments 'City','Contains','Omaha' neither method returns any rows. Each field in the database is de...more >>

Creating a table from a view
Posted by Gerard at 3/14/2006 6:36:29 AM
Does anyone know a good way to create a table from an existing view...maybe some jiggery pokery with sp_columns or something. Im tring to create a set of tables from a set of views, and do the whole thing in batch so im hoping to carry out the table creation dynamically Thanks Gerard...more >>

Select this and last years data to show side by side
Posted by zu at 3/14/2006 5:16:27 AM
My first post didn't come through so I hope I don't post twice. Trying to select data from two years side by side I'm running into troubles. I tried it with the follwing SQL but it slightly is not working. Someone sees what's wrong? SELECT VJ.konbeberechnung_artikel_ID, VJ.artikel_bezei...more >>

Challanging task, for fun - answer two questions from given data!
Posted by zekevarg at 3/14/2006 5:12:58 AM
Hi, I'm looking for the answer to these questions. 1. How many rows contained in table PERSON 2. How many rows contained in teble CAR ONLY by reading information given. No DB's is needed! Following table contain info about persons. Table do contain a lot of rows! CREATE TABLE Person ...more >>

Looking for a generic list
Posted by Enric at 3/14/2006 5:09:29 AM
'afaik', 'asap', 'imho', 'rtfm' and so on are very useful, overall when you read texts. Does anyone here have a greater list? -- current location: alicante (es)...more >>

Error (8626) while inserting record into table with text field and which is the base for indexed view
Posted by ing42 at 3/14/2006 4:23:45 AM
I have a problem with inserting into table while an indexed view is based on it. Table has text field (without it there is no problem, but I need it). Here is a sample code: USE test GO CREATE TABLE dbo.aTable ( [id] INT NOT NULL , [text] TEXT NOT NULL ) GO CREATE VIEW dbo.aView...more >>

snapshots on sql25k
Posted by Enric at 3/14/2006 2:34:19 AM
I was wondering if is allowed to restore a snapshot into a another database, not the source one. regards, -- current location: alicante (es)...more >>

HELP ME!
Posted by zekevarg at 3/14/2006 2:22:04 AM
Hi, locking for the answer to these questions: 1. How many rows contained in table PERSON 2. How many rows contained in teble CAR Following table contain info about persons. Table do contain a lot of rows! CREATE TABLE Person { PersonID int NOT NULL IDENTITY(1,1) PersNumber char(11) ...more >>

HELP ME!
Posted by zekevarg at 3/14/2006 2:19:57 AM
Hi, locking for the answer to these questions: 1. How many rows contained in table PERSON 2. How many rows contained in teble CAR Following table contain info about persons. Table do contain a lot of rows! CREATE TABLE Person { PersonID int NOT NULL IDENTITY(1,1) PersNumber char(11) ...more >>


DevelopmentNow Blog