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
August 2008
all groups > sql server programming > may 2004 > threads for monday may 3

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

Splitting the String
Posted by Ramnadh at 5/3/2004 11:51:03 PM
Hi I have the problem in splitting the string in T-Sql For example the string is like $EmpId = 1$; $EmpMgr=2323$;$DeptNo=20$ I have to get the EmpId , EmpMgr and DeptNo from the string i.e 1,2323 and 20 and use those values in th query. can anyone help me how can the splitting of the str...more >>


'' vs ' '
Posted by toylet at 5/3/2004 11:26:42 PM
Is it safe to assume that an empty string (which contains any number of space characters) is always equal to ''? Or should I go for ltrim(rtrim(@string))=0? -- .~. Might, Courage, Vision. In Linux We Trust. / v \ http://www.linux-sxs.org /( _ )\ Linux 2.4.26 ^ ^ 11:22pm ...more >>

cross-tabulation
Posted by toylet at 5/3/2004 8:50:47 PM
given this table: staff_id trx_type amount -------- -------- ------- 001 A 10 001 B 20 002 C 10 how to convert into this form the smart way? staff_id A B C -------- ---- ---- ---- 001 10 20 NULL 002 NULL ...more >>

Selecting the latest record
Posted by Robert Armstrong at 5/3/2004 8:42:24 PM
I am trying to create a late rental report for a video game rental store. The problem is the only way to determine if a game has been rented is by searching the description of the game field which has been modified to have the date + '2DY' + 'some string of numbers'. So what I have done is searc...more >>

How to line up first month, second month, third month etc.
Posted by uteitler NO[at]SPAM securedatagroup.com.au at 5/3/2004 8:38:29 PM
We would like to analyse some sales transactions and check a theory of monthly growth. ie the third month growth of a customer is 1.5 the original month. We have a basic Sales Transaction table with: The following fields: TranDate, Client, State, Amt, SalesType 10-mar-2003, ABC, CA, 1000...more >>

I need help to create a pivot table in sql
Posted by Paul at 5/3/2004 8:10:05 PM
I have two tables with one to many relationshtp. I need to create a view to display all the records in the "one" table and pivot one of the field and an aggregate sum of another field in the "many" table. At present not all "key" records in the "one" table have relate records in the "many" table....more >>

Insert with no logging in transaction log
Posted by Roger Twomey at 5/3/2004 7:28:22 PM
I have a table that I use for an intermediate step in importing data. All incomming data is inserted here, then checked for consistancy and inserted into the table where it belongs. (batches). The transaction log is getting very large and I really don't care to log the transactions in the init...more >>

trimint string data
Posted by jb at 5/3/2004 6:26:05 PM
I have a column of strings that have leftmost spaces that need to be trimmed. What would be the easiest way to do this Thank Jb...more >>



extending decimals
Posted by dk at 5/3/2004 6:21:20 PM
trying to duplicate an access query in sql server 2k which shows 10 or more decimal places. what needs to be done to extend decimals in sql? i've cast the fields which are muliplied as numeric(24,12), but they still only display max of 6 decimal places. any idea how to extend this? tia...more >>

Dynamic SQL another example
Posted by Mario Reiley at 5/3/2004 6:02:03 PM
In several messages that I post early I need help for create Dynamic SQL or that I trying to do. Here is an example of my store procedure ALTER PROCEDURE dbo.Test /* ( @parameter1 datatype = default value, @parameter2 datatype OUTPUT ) */ AS SET LANGUAGE us_english SET NOCOU...more >>

Median
Posted by Reza Alirezaei at 5/3/2004 6:00:31 PM
I am using this query to calculate Median of a group of data.it works fine but when there are 3 records ,it dosen't work .can anyone solve the issue. INSERT INTO @Median SELECT total FROM mytabel SELECT @cnt = COUNT(*) FROM @Median /*Number of rows to be calculated*/ IF ( @cnt % 2 ) = ...more >>

Date based select and update
Posted by John Michl at 5/3/2004 5:43:25 PM
I have a query that is supposed to populate a table called CUSTOMERS with information from the first transaction for that customer. (CUSTOMERS includes an ID field called CUSTOMERID which is unique.) The transaction info is in a table called HISTORY. I've picked some samples off of some usenet...more >>

how to sort numeric vales
Posted by Reza Alirezaei at 5/3/2004 5:31:16 PM
I have got a query like this: a 12 b 3 c 66 d 77 m 1 h 100 I want to do sorting based on the numbers (order by seems to sort based on characters asci code) would appriciate your help. ...more >>

System Restore in Windows Server 2003
Posted by Lawrence at 5/3/2004 5:26:02 PM
Hi I am wondering if there System Restore feature in Windows Server 2003. Let me know where I could run this if it exists. Thanks -Lawrence ...more >>

sp_executesql and SELECT .. IN
Posted by Trapulo at 5/3/2004 5:13:47 PM
I need to filter a select with IN statement: SELECT * from table where ID IN ( ...... ) But the IDs list is based on a dinamically creates SQL Statement, that I run with sp_executesq. So I cannot use a statement as SELECT * from table where id in (select id from table2). How can I create a ...more >>

What is "WHERE 1=0"?
Posted by Barnabie at 5/3/2004 5:06:03 PM
HI In some sql select queries you have "where 1=0". WHat does mean and do Sorry am a novice cheer Barnabie...more >>

Security - NT Authentication
Posted by MS User at 5/3/2004 5:00:45 PM
SQL 2K We are in the process of forcing our developers logging into Servers by NT Authentication. Controlled user-access level from the NT groups. Here is my scenario, I have a user 'Mydomain\Myuser' with full rights on server 'MyServer' . Inside SQL Server, I don't have a login for 'Mydomai...more >>

rule is sql server
Posted by Aju at 5/3/2004 4:44:15 PM
Can anyone please explain about a object rule in sql server ??? Regards Ajay ...more >>

COUNT(*) in WHERE clause
Posted by PJ at 5/3/2004 4:31:46 PM
i have the following script: ----------- declare @field_count int declare @x table ( metafieldid int primary key , value varchar(50) ) insert @x ( metafieldid, value ) select metafieldid, value from ufMetaDataSelectOpenXml(@metaxml) select @field_count = count(*) from @x insert @...more >>

Error : The process could not bulk copy out of table '[dbo].[syncobj_
Posted by Arda Han at 5/3/2004 3:23:00 PM
Hi friends, I have a problem with my Sql Server (Win2k Server, Sql Server SP3 updated) replication. My replication stopped with "The process could not bulk copy out of table '[dbo].[syncobj_....." message. What is wrong? Could anybody help me? Arda Han Software Engineer ...more >>

Quering two databases
Posted by Vik at 5/3/2004 3:14:52 PM
Is it possible to create a query (a view/stored procedure) based on the tables from two different databases? Thank you. ...more >>

Test
Posted by Vlad at 5/3/2004 2:47:50 PM
I have a problem with posting today. Some of my messages appear on news group, some don't. What it depends on? I reposted one message 3 times with intervals. And it's not here. Does the contents of the message affect it's appearance? I included in lost messages the text of trigger. Nothing speci...more >>

COLUMNS
Posted by Fab at 5/3/2004 2:30:21 PM
HELLO... HOW WOULD I FIND ALL COLUMNS THAT HAVE THE WORD *_CASE* IN IT USING SQL? ...more >>

Identity Column as varchar
Posted by Michael Tissington at 5/3/2004 2:24:53 PM
How can I have a varchar column work as an identity column? Basically I need to automatically put an incrementing value into a varchar field. Any ideas please. -- Michael Tissington http://www.oaklodge.com http://www.tabtag.com ...more >>

IN
Posted by Rajan Moorjaney at 5/3/2004 2:23:12 PM
Friends, I have this value @status =3D "P, R, A" which I would be passing to a = stored procedure=20 I thought I could use IN in the stored procedure instead of =3D but I = get syntax error. =20 ------- WHERE .... .... and (@status is null or status IN @status) ..... ------ =20 ...more >>

bcp data export from SQL Server to file
Posted by Nikolai Todorov at 5/3/2004 2:01:39 PM
I have a bcp command which exports a SQL table to a file in a directory. When I start the command from the command prompt it works just fine. But when I try to start it threw a .NET application using a SqlCommand object with a parameter the string of the bcp command - nothing happens! The Execut...more >>

Returning uniqueidentifier value from a sproc
Posted by AlBruAn at 5/3/2004 1:56:02 PM
I've written a stored procedure to enter data into a table consisting primarily of nvarchar and ntext fields with a uniqueidentifier field, which is being used as the primary key. In my application, I need to grab a copy of the uniqueidentifier for the record being written for use later on in the a...more >>

UDF as a system function
Posted by dave at 5/3/2004 1:54:13 PM
I am having some confusion with why a UDF defines to be a system function must begin with fn_. I see docs that recommend UDFs begin with fn and I have found many docs which explain why a UDF is two or three part qualified name to distinguish it from system functions which are non-qualified names...more >>

Query Help: extract summary from related fields
Posted by John Bonds at 5/3/2004 1:49:54 PM
Here are the tables I'm dealing with: CREATE TABLE [dbo].[DataField] ( [OrgID] [int] NOT NULL , [OrgLocID] [int] NOT NULL , [DataFieldID] [int] NOT NULL , [RegExFormat] [varchar] (300) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL , [FieldName] [varchar] (20) COLLATE SQL_Latin1_General...more >>

Help with query
Posted by Tim at 5/3/2004 1:13:12 PM
2 Tables Tbl_1 1 null 2 null 3 null Tbl_2 2 'abc' I want Output to show: 1 null 2 'abc' 3 null Regards, Tim ...more >>

Table Locking
Posted by John Dickey at 5/3/2004 1:01:59 PM
I think I need some good references to SQL Server to learn some basic functions. I have a stored procedure that creates document numbers with a value within a table. 2 instances of our application called my stored procedure and at the same time, they accessed the value and generated d...more >>

BULK Insert Problem
Posted by Prabhat at 5/3/2004 12:49:43 PM
Hi All, I work in a Network Environment. My System Number is "system1" where the SQL Server DB is Installed. And If I Try to Bulk Insert any thing from my system Then it works fine. But If I Try to do Any BULK INsert from "system2" then I Get the below ERROR!!!! Server: Msg 4861, Level 1...more >>

Your bosses bosses boss.
Posted by Spring Chicken at 5/3/2004 12:42:07 PM
Given the following table... CREATE TABLE [dbo].[tblEmployees] ( [EmployeeID] [int] IDENTITY (1, 1) NOT NULL , [SupervisorsEmployeeID] [int] NULL , [JobTitle] [nvarchar] (50) NOT NOT NULL , [JobDescription] [nvarchar] (200) NOT NULL [FirstName] [nvarchar] (50) NOT NULL , [LastName] ...more >>

Time Out Error
Posted by larry at 5/3/2004 12:25:47 PM
I am getting an error on an ASP page that does a simple update to a single row in a table. The SQL statement is: UPDATE tblRecHead SET Qty = 1 WHERE SeqNum = 123 and LineNumber = 12 The ASP page will time out and return an error. If I change the SQL to: UPDATE tblRecHead SET Qty = 1...more >>

inner joins and where clauses
Posted by Raterus at 5/3/2004 12:20:36 PM
Can someone help me out with this. Say I have a simple inner join Select * From myTable t1 inner join anotherTable t2 on t1.id =3D t2.id Where t2.field =3D 'something' I can rewrite this join like this, elimating the where clause Select * From myTable t1 inner join anotherTable t2 ...more >>

Problem inserting decimal data
Posted by Simon Harvey at 5/3/2004 12:10:04 PM
Hi all, I have a number of columns in an SQL server table that are of type Decimal. The problem is, when I create a stored procedure and add decimal data to the table, the decimal places are chopped off. The number of decimal places to be stored is set to auto, so that should be ok. Does an...more >>

Dynamically drop and recreate tables
Posted by Jonathan Blitz at 5/3/2004 12:01:46 PM
I need to be able to allow the user of my system to clear the data in ceratin tables. The easiest and cleanest way for me to do so is to drop and re-create the tables as this also resets all the ID columns. I can put the commands in a SP but this means that everytime I make an alteration to t...more >>

MSDE and first db attempt
Posted by dotnet dev at 5/3/2004 11:47:58 AM
Hello, we are working on our very first database attempt using MSDE and ADO.Net in our VB.Net application. We have many unanswered questions like: 1> how would we update database (add tables/modify fields etc) for clients between our subsequent releases without loosing their data. 2> how wil...more >>

table relationship to itself
Posted by 6tc1 NO[at]SPAM qlink.queensu.ca at 5/3/2004 11:21:23 AM
Hi all, I have a table in my database that is causing me some problems. The scope of this problem is limited to two tables - table A and table B. table A has a primary key of type nvarchar(100) - let's call it "UID" table B has an ID (not necessarily unique) - call it "myID" and a foreig...more >>

Deleting a Record
Posted by TerryM at 5/3/2004 11:21:18 AM
Hi, I know nothing about scripting operations on SQL, so I'm hoping someone could help. I want to simply go through a table and everytime one of the columns equals a certain value I want to delete that record. So I have a Database called SMS_C00 I have a Table called PkgServers in it are ...more >>

Trigger Help
Posted by Vlad at 5/3/2004 8:52:23 AM
Sorry if this post is there already. I cannot see it although I made it before my other posts which I see. I have 3 tables - Job (real name is Sopa), Order (real name is Ordr), OrderDetail. All of them have a bit type field RowDeleted. I would like to update this field in Order and OrderDetail...more >>

BETWEEN in dynamic SQL
Posted by Vlad at 5/3/2004 8:44:49 AM
I have this stored procedure which uses dynamic SQL: CREATE PROCEDURE CRCommissionPayments @Salesman int=null, @CheckNumber varchar(20)=null, @DateMin varchar(20)=null, @DateMax varchar(20)=null, @SortBy varchar(50)=null, @SortOrder varchar(10)=null AS DECLARE @sql nvarchar(1000) DECLAR...more >>

Identity column overflow
Posted by Bob at 5/3/2004 8:36:02 AM
I recently discovered that when an identity column overflows, you get a SQL error when you try to insert. What is the best method to handle a reset of the identity seed since the table may contain old rows with random numbers which may be foreign keys?...more >>

OUTPUT of type TABLE
Posted by Eric D. at 5/3/2004 8:32:58 AM
Hi, Is it possible to send a table, derived from the TABLE data type, from one SPROC to another? I'll give you a break down of my problem, and perhaps there is a better way to do what I want. -I have a SPROC (let's call it "MAIN") that returns a result set (this result set was generat...more >>

Dinamic SQL questions
Posted by Mario Reiley at 5/3/2004 7:50:40 AM
Hi , group I am trying to create a SQL dinamicaly in a Store Procedure but all the time I recive the following error: Syntax error converting datetime from character string. Here is my SQL: declare @sql nvarchar(1024) declare @Desde int,@Hasta int declare @FDesde nvarchar(10),@FHasta nv...more >>

Update Inserted Record
Posted by rsorrell NO[at]SPAM aei.ca at 5/3/2004 7:12:16 AM
I am trying to update a record based upon a value found in a view of a parent table. This is what I have attempted - I don't get a syntax error but nothing seems to happen. The ITEM field is equal to the sequence key in the Parent View called V_InvItems - I need the view as that view uses a fi...more >>

How to develop a interface preferably web UI to maintain SQL server tables
Posted by simonlenn NO[at]SPAM yahoo.com at 5/3/2004 6:43:37 AM
I need to build couple of user interfaces to enable users to maintain a table like add new records , delete existing records and modify existing records. I would preferably like to do this from a .Net system they must be easy to deploy and universally accessible across the company. Please a...more >>

How to publish dashboard for SQL Server
Posted by simonlenn NO[at]SPAM yahoo.com at 5/3/2004 6:35:31 AM
I have a requirement to publish dashboards for SQL Server like gauges, sliders, graphs, etc to a digital dashboard. Please advise which is the best way to publish dashboards on SQL Server. Also please point me to some resources on some sample dashboards to SQL Server. If it is Sharepoint ca...more >>

xp_cmdshell permissions
Posted by John Holland at 5/3/2004 5:56:07 AM
I am using xp_cmdshell in a couple of stored procedures to do some decrypting of files tha were transferred and then using bcp to copy the data into tables. This has been working jus great up until about 2 weeks ago when it stopped working. I hadn't changed anything as I have not been on the m...more >>

ADDING A PRIMARY KEY
Posted by Konstantinos Michas at 5/3/2004 2:34:33 AM
Hello Experts, I'm a little bit confused about what happening with these queries. I'm trying to add a priamary key on my table. The First Set of queries do not do that, the Second Set does that, the funny thing is that I don't see a serious reason not adding my PK with 1st Set of qurei...more >>


DevelopmentNow Blog