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 > may 2004 > threads for tuesday may 25

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

Fixed byte file generation from bcp...
Posted by Sam at 5/25/2004 11:51:03 PM
Hi All I am working on a database with Japanese_CI_UI collation and want to generate file in fixed byte(not characters) format. I have defined all columns as nchar and used bcp/queryout option. But I found that the file does not get generated in fixed byte format instead bcp onverts all possilbe d...more >>


Accept cascading delete and regject others
Posted by newscorrespondent NO[at]SPAM charter.net at 5/25/2004 10:05:45 PM
From in a delete trigger I would like to allow deletions cascading from a parent table and reject any deletes done directly to the table with the trigger. Is there any way from within the trigger to distinguish these two conditions? Thanks Tom G....more >>

simple SQL query problem...
Posted by Chris Dangerfield at 5/25/2004 8:57:07 PM
Hi there, I could do with a little help on a sql query. I have a table with 4 cols resolution, browser, datetime, ipaddress I am trying to establish how many unique visitors in a receiving and what browser and resolution they are using. CREATE VIEW dbo.view_www_visitor_stats AS SEL...more >>

OSQL and collation
Posted by Dariusz Hoszowski at 5/25/2004 8:50:00 PM
Hi, i have got a problem with osql.exe (or isql.exe). Both have same problem running query with non english words (which have to be inserted into table). The same query but from Query Analyzer make it all right (non-english words are non-english). example file: CREATE TABLE test ( id in...more >>

COnvert columns to row
Posted by Ashish Kanoongo at 5/25/2004 8:49:07 PM
I have data in following structure NUM Altpar01 Altpar02 Altpar03 Altpar04 1 11 21 31 41 2 12 22 32 42 3 13 23 33 ...more >>

remove string
Posted by HartmanA at 5/25/2004 8:40:48 PM
If you have a field called Last_name which has data like this: Jones Jr,Bobby T. ---> becomes ----> Jones, Bobby T. Clark II,Bill N. ---> becomes ----> Clark, Bill N. Can I have a script that parses that "Last_Name" field and removes the Jr or II or III or Sr but leaves the ...more >>

Easy Trigger "?" question
Posted by steve.beasley at 5/25/2004 8:11:04 PM
I would like to know the best method (detailed if possible) for duplicating primary keys. I have a database with 5 tables, (tableA, tableB...) each with a primary key of JobNumber. If and when someone inserts a new JobNumber into Table A, I would like the corresponding field in the other four tab...more >>

Returning SQL servers & DB's
Posted by Craig G at 5/25/2004 5:15:48 PM
Hi i have a little VB project that basically needs to find all SQL Servers on our Network from here it will then ask you to logon to the server then populate a combox box will all the db's for that server, for which the user has access too i want to do it by calling sp's, what do i need to d...more >>



delete all triggers
Posted by Patrick at 5/25/2004 4:46:18 PM
Hi Freinds, SQL 2000 I attached a database which was in a replication before. All the tables has DEL / INS / UPD triggers. How can I delete all those triggers at once? and make the database usable for single mode use? Thanks, Pat ...more >>

Comparing COUNTs from a self-join
Posted by Mark Davies at 5/25/2004 4:45:57 PM
OK, here's the problem. I have data from a 100 million word corpus of English, with all of the distinct two-word clusters in the corpus. Suppose it were just a ten word corpus composed of the sentence "I ate the ice cream and Mary ate the cake" -- the rows would be the following: ID word1 ...more >>

newest date
Posted by Stefan Willem at 5/25/2004 4:17:04 PM
Hello, I have a table with three columns date1, date2, date3. I have to search the newest of the dates (this could be in any of the three columns) for every data set, in order to give it out in a new column 'newest date'. For example: number date1 date2 date3 ...more >>

Date / Time select Problem
Posted by Jan Schmidt at 5/25/2004 4:15:32 PM
Hi NG, i've got a mystic problem i can't solve, perhaps one of you has a good idea... i will explain with some code, so fo better understanding my probroblem: i'll use asp, but for testing the syntax i use the MS Query Aanalyzer. following Stored Procedure is ok and does it's job fine with "...more >>

How do you determine an index size
Posted by newbie at 5/25/2004 3:51:03 PM
EM reports table size and individual index size. Does it use "sysindexes.used" column to determine how many pages an index uses and then calculates the index size? Is there any other (programmatically) way to determine how much space an index uses?...more >>

Converting 10gig of files to sql server text fields
Posted by Paul at 5/25/2004 3:48:31 PM
Hi I'm working on a project to convert around 150 gig of word and .rtf files stored in various different directories into a SQL SERVER database, using text columns. I'm trying to figure out the best approach to take, I'm thinking maybe I could do this in DTS, or .NET? Alternatively does a...more >>

How to disable error message
Posted by DC at 5/25/2004 3:03:33 PM
I have function like this: ALTER FUNCTION dbo.GetGPAValue ( @GPA varchar(5) ) RETURNS numeric(5,2) BEGIN DECLARE @FinalStatus numeric(5,2) SET @FinalStatus = CAST(@GPA as varchar(5)) IF @@error > 0 SET @FinalStatus = 0 RETURN @FinalStatus END The problem is wh...more >>

Consolidating queries
Posted by Thane Peterson at 5/25/2004 2:57:52 PM
I have this table: create table Permission ( Id int, Type char(1), SubId int, Auth char(1), constraint PK_Permission primary key (Id, Type, SubId) ) inside which, lets say exist these values: insert Permission values (1, 'D', 1, 'P')...more >>

Need basic help with Cursor
Posted by Terri at 5/25/2004 2:38:43 PM
I must be missing something simple here. I create a table with sample data. I open a cursor on the sample data and insert into a results table. The sample data and the results data are not the same. Thanks DROP TABLE Testdata CREATE TABLE Testdata ( [testvalue] [char](1) ) INSERT IN...more >>

String functions
Posted by droth at 5/25/2004 2:20:54 PM
I am doing some data cleansing on email addresses. I am looking for a string function that will remove a trailing single quote. eg. someone@somwhere.com'. ...more >>

sql 7 db restore to sql 2000 server
Posted by JJ Wang at 5/25/2004 2:20:06 PM
Hi, I have a sql 7 server want to get rid of, but, before that, I need to move one db off this sql 7 server onto sql 2000 server. Is this anything special I need to do during the db restore process onto sql 2000 server? many thanks. JJ ...more >>

create index on table
Posted by JJ Wang at 5/25/2004 2:16:21 PM
Hi, What's the difference/performance difference when you create a index with two columns combined vs create two indexes with each one of them as showed below? 1. CREATE INDEX [index1] ON [dbo].[table1]([MARKET], [DATE]) WITH FILLFACTOR = 75 ON [primary] 2. CREATE INDEX [index1]...more >>

How to call a user defined function from VB
Posted by Peri at 5/25/2004 2:11:52 PM
Hi, Can any one tell me how to call a user defined funtion from VB ? This is a partial Code. svValueString = "ABC" lngField = 1 svValue = "" svSql = "SELECT dbo.fn_GetValue(svValueString, lngField)" Set rsTemp = New ADODB.Recordset With rsTemp .ActiveConnection = conn .Cu...more >>

Basic big-picture question on table design
Posted by Boris A. Chernick at 5/25/2004 2:11:04 PM
I'm studying for 70-229 and designing a database, and I'd like a little reassurance at this point. (Sorry if I'm nitpicking. Do I understand this correctly 1. A primary key is highly recommended but it is not essential that any one primary key column be an Identity column. (It is not essentia...more >>

Index and Begin With search
Posted by A.M at 5/25/2004 1:45:09 PM
Hi, I have an index based on column "Name" called IDX_Name. I know that if I have a query to search for specific column, IDX_Name will be used. Now I want to search for Names that begin with sepcific letters. If I use a query like: Select * from tblCustomer where Left(Name ,3) = 'ala' ...more >>

Parametrized Stored Procedures with conditional execution
Posted by Jerry at 5/25/2004 1:10:09 PM
I have the Proc below which is supposed to perform a SELECT with different properties based on the parameters sent to the procedure. I understand that when "If" statements are used the result set is not sent back to the client. If I have logic which performs the desired select statement how do I...more >>

A way to select random records?
Posted by Jim Bancroft at 5/25/2004 12:57:43 PM
Hi all, Has you ever had to select a "random" set of records from a table? I need to retrieve groups of 10,000 records from a table (out of 500k) and put them into other tables. I'd like a decent variation in the returned rows, which is why I'm thinking of a randomized select statem...more >>

Using sp_executesql
Posted by Sergei Almazov at 5/25/2004 12:50:51 PM
Hello. I'm writing a query that checks all databases on the SQL Server against some rules (it finds all DBs my program may use). In general it works good but some clients had a problem. I found the way to replicate the bug: DECLARE @Name sysname, @SQL nvarchar(1000), @Param nvarchar(50), @IsOu...more >>

Date Format in SQL Server with VB as front end
Posted by Peri at 5/25/2004 12:43:49 PM
Hi, I am really confused on how to use date in VB with SQL server 2000 application. My scenario is this: 1. I want to design an application which is system date format independent. What ever the system date format is the application should work. 2. I want to design an application which i...more >>

query chalange
Posted by Patrick at 5/25/2004 12:20:37 PM
Hi Freinds, I am stocked on this : This is my table : id code1 code2 ------------------------ 350 office department 350 office office 350 office project 350 office csd 350 department department 35...more >>

change of recovery model
Posted by mike at 5/25/2004 12:11:12 PM
can the recovery model of the database be changed from Full to Simple mode? what are the implications?...more >>

Datetime conv. problem % MSExcel & SQL
Posted by Leonard Poon at 5/25/2004 11:59:54 AM
Does anyone know the reason why the result of conversion of datetime value is different between MSExcel and MSSQL2K. I've tried to import a column of datetime values from Excel to MSSQL database. However, the values after the conversion were not the same as in Excel. At first, I converted all ...more >>

function to compare/join tables on dates +- n?
Posted by Rich at 5/25/2004 11:53:12 AM
I'm having some issues comparing data from 2 external sources, based on an mID field and a date field. I just got another twist. The data for an mID in source1 for 4/1/04, is related to the same mID in source2 for 4/2/04. I was joining tbl1 and tbl2 on mID and Datefld. Now I need to jo...more >>

count with case statement
Posted by JT at 5/25/2004 11:52:28 AM
what is the syntax to use count with a case statement? i need to perform a bunch of different counts on a table based on different criteria and i' like to do it in one query - this is what i mean: maybe i don't need to use a case statement, i just want to simplify this: select dealer_id i...more >>

corelated query
Posted by Ramesh at 5/25/2004 11:51:50 AM
Dear All Please Explain me diff between corelated query and subquery with a example Ramesh:) ...more >>

Running Access Macro using SQL
Posted by J. Joshi at 5/25/2004 10:45:24 AM
Hello all, Is there anyway I could trigger an MS Access macro (a.k.a. the Access Autoexec system macro) via the SQL Job Scheduler? If not, will I have to compile a store procedure? If yes, then can you direct me to any available code if possible? Is there any simpler way to run acce...more >>

Error creating a trigger on a view
Posted by Nikhil Patel at 5/25/2004 10:41:35 AM
Hi all, I am trying to create a trigger on a view from SQL Query Analyzer. But I keep getting an error: Invalid object name 'dbo.WV_Contsupp'. I thought may be the view did not exist. So I ran the following SELECT statement from the same sql connection(window) I am using to create ...more >>

how to update a count field with incremental values?
Posted by Rich at 5/25/2004 10:40:01 AM
Hello, below my example is a basic ddl and sample data. TblA contains 3 fields (for my question), Datefld (dateTime), mID (varchar - not unique), mIDCount (int). Datefld and mID get populated from an external data source. I want to count all mID's for a given day as below and then upda...more >>

help with Query building
Posted by Craig G at 5/25/2004 10:12:49 AM
i have 2 tables Calender (caldate, working day, dayofweek) calender would contain a date range, working day is set to N if it is a saturday/sunday, dayofweek is the name i.e monday, tuesday etc eg 01/01/2000, N, saturday 02/01/2000, N, sunday 03/01/2000, Y, monday ......... ......... ...more >>

Select latest record from join
Posted by Paul at 5/25/2004 9:21:49 AM
Hi All I have 2 tables (one is candidates, the other is telephone calls) and i want to join them to show a row for every candidate joined with the latest phone conversation. I am currently doing it like this: select * From Candidates left outer join ( select CandidateID, Max (CallDate) As...more >>

Deadlocks on Update
Posted by Vidya at 5/25/2004 9:21:05 AM
I have a multithreaded service executing a stored procedure which updates the table shown below. SQL Server repeatedly runs into deadlocks on the Update statement given below. I have included the trace error log messages as well Is the Inner Join in the Update query causing locking issues? Any ins...more >>

Import XML file
Posted by ReidarT at 5/25/2004 9:20:52 AM
Is it possible to import a XML-file to an SQL-table? reidarT ...more >>

Can a whole query be a variable in stored procudure?
Posted by Bruce at 5/25/2004 8:42:39 AM
Hi, all, In a stored procedure, is it possible to run a variable- based query. For example: declare @wholequery varchar(1000) set @wholequery = "select customername, address from customer" Is it possible to run @wholequery? Thanks a lot ...more >>

catching bcp errors
Posted by tim at 5/25/2004 8:39:52 AM
I have a stored procedure that uses BCP to load records using the xpshell cmd . how do I catch/test that all row are loaded. I tested one file, where one row was not loaded due to a invalid column. but all the rest where loaded. How do I test that all row where loaded ...more >>

log shipping
Posted by Ron VZ at 5/25/2004 8:26:58 AM
We are currently setting up log shipping using SQL 2000. We have a local server on a 15 minute delay and a remote server on a 3 hour delay. I am curious as to the process of recovering the logs in the event of a failover. Has somebody ever done a script, or know of a way to automate the process...more >>

Stored Procedure calling another that returns a value, no output parameter
Posted by Colin Colin at 5/25/2004 8:07:39 AM
I have a Stored Procedure that I wrote a while ago that accepts 1 parameter, and at the end of the SP I do a SELECT so it returs a ?recordset? containing a value. I am using this SP from various ASP pages on my intranet site. Here is the code: Public Function GetID(ByRef Coum_cn, ByVal TblN...more >>

create procedure - why does it not fail creation ?
Posted by Mikey at 5/25/2004 5:51:02 AM
Anybody any idea why the third stored procedure is created but fails when you execute it. The second one - I have included to show that columns are correctly raised as errors but not when the tablename is wrong No Warning no nothing Should this not fail creation - I have been puzzled as to why ...more >>

Date Driven Query
Posted by Peter Newman at 5/25/2004 5:46:02 AM
I have a table as follows CREATE TABLE [dbo].[DebBacsFMPendingFiles] [Licence] [varchar] (6) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL [ReportNumber] [varchar] (6) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL [RecievedDate] [datetime] NOT NULL [AppliedDate] [datetime] NULL [S...more >>

Profiling
Posted by Anon at 5/25/2004 5:16:02 AM
I've used the profiler a million times. I'm having a problem on a new Server that was set up recently. When I trace stored procedure events for a particular stored procedure (filtered in TextData) all I see is an occasional RPC:Starting and RPC:Completed sp_sproc_columns N'my_proceure', NULL, NULL...more >>

Error message in asp page when submitting to database
Posted by gazzer at 5/25/2004 3:41:05 AM
Hi all. ======= ERROR MESSAGE ================== Microsoft OLE DB Provider for ODBC Drivers error '80040e14' [Microsoft][ODBC SQL Server Driver][SQL Server]Unclosed quotation mark before the character string 'Entry Level 1'. /learningcentres/questionnaire/updatequestionnaire.asp, line 27...more >>

text search on stored procedures
Posted by toylet at 5/25/2004 3:34:11 AM
Anyone got a handy stored procedure that list the user stored procesure names containing a certain string (case sensitive or insensitive)? It would be nice if it could work like grep, that disaplayes the line containing the string. :) -- .~. Might, Courage, Vision. In Linux We T...more >>

How to retrieve all information abt all constraints inorder to drop and recreate them
Posted by S at 5/25/2004 2:31:07 AM
Hello I need to retrieve all the information about all the foreign key constraints,inorder to store them temporarily (to be deleted later)and then recreated after making the necessary modifications to the concerned tables The stored proc sp_helpconstraint shows all the constraint types, their user...more >>

open a text file using sp_oamethod
Posted by Carlos Ortega at 5/25/2004 1:21:04 AM
I'm trying to write a text file using a SQL store procedure. I'm using the sp_oamethod to open a text file using the following sentenc declare @o int, @f in exec sp_oacreate 'scripting.filesystemobject', @o ou exec sp_oamethod @o, 'opentextfile', @f out, 'c:\test.txt', 8, I'm getting the erro...more >>

Returning contents of a query as a cell in another query?
Posted by Tom Spence at 5/25/2004 12:28:40 AM
Let's say I have a query 'SELECT tableID, Comment FROM tbComments'. Let's also say I want to run a query that gets me all the items in a table (call it tbTable), and in the same row return all of the corresponding 'Comment' values from the tbComments table where tableID = tbTable.ID. Were 'co...more >>

Stored Procedure assistance required.
Posted by Tom Spence at 5/25/2004 12:20:29 AM
I find it necessary to have to call a stored procedure, let's say procCheckID, using as a variable the contents of a column - let's call it ID - returned from a Query. At the moment I do this by looping through a recordset in ASP, calling the procedure each time. I'd prefer to write a specific...more >>


DevelopmentNow Blog