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 > september 2006 > threads for wednesday september 20

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

Create Procedure with Encryption
Posted by Jami at 9/20/2006 11:49:34 PM
Hi to All! I have created a stored procedure with Encryption option. now i wants to modify that procedure but with SP_Helptext command it is not showing me its contents. how can i decrypt the stored procedure to modify it. Regards, Jami. *** Sent via Developersdex http://www.deve...more >>


calling sp from vb.net
Posted by Phil Hellmuth at 9/20/2006 11:26:31 PM
I hope this is the correct forum for this issue. I'm trying to call a SQL stored procedure from vb.net using parameters, but am running into problems. Here's pertinent SP code: CREATE PROCEDURE dbo.sp_TestSP ( @Field1 nvarchar(11) , @Field2 nvarchar(30) ...more >>

Need Help! Connection Count to Linked DB2 Server Reaches limit (SQL1040N) when execute dynamic generated OPENQUERY T-SQL
Posted by alingsjtu NO[at]SPAM gmail.com at 9/20/2006 10:23:45 PM
Need Help! Connection Count to Linked DB2 Server Reaches limit (SQL1040N) when execute dynamic generated OPENQUERY T-SQL Hello, every body. I created a linked server to DB2 8.1 database which called GRR_DB2Server. In my stored procedure p_FetchRawData, I need to read some data from this lin...more >>

need help improving insert statement
Posted by mchi55 NO[at]SPAM hotmail.com at 9/20/2006 9:16:31 PM
Here's an insert statement. It runs sometimes up to 5 seconds. It seems rather repetitive and wordy...and I was wondering if anyone knew how I could rewrite it so it is faster. This particular update statement updates 7400 rows. thanks. Update ClientContacts SET StatusID = ( select...more >>

Insert record to table with single identity column
Posted by Jason Chan at 9/20/2006 8:53:02 PM
I have a table with only one column which is identity int. I use this table to keep trace of the seq no of a application. However I dont know how to insert record to the table. If the table have 2 columns which one is identity I can do something like INSERT INTO tblName (nonIdenityColName)...more >>

Can I use conditional field in insert
Posted by mamun at 9/20/2006 8:26:24 PM
Hi All, I need to insert records based on a condition where the field names will change. For example, I want to do the following: insert (field1, field2, Case when @var1='X' field3 else field4 end) values(value1, value2, value3) Is that possible by any means? I will highly appre...more >>

sql query
Posted by lara at 9/20/2006 8:25:37 PM
I have a table called Expressions, which is having the columns ExprID, LeftExpn and RightExpn all int I want to remove the duplicates from this table Duplicate records are those, which may contain the same values in the LeftExpn, same vals in the RightExpn , if one of the left values exists in...more >>

Parameter Sniffing (Resolution???)
Posted by DotNetNow at 9/20/2006 7:28:02 PM
Sorry to stir this issue up again... (SQL 2000) OK I replaced the Declare variables with parameters and created the Stored Proc with Recompile option, passed in all the parameters as dates instead of building the dates in my proc, and WOW it runs great! I passed in all the dates to the St...more >>



Constraining Data (sometimes)
Posted by Bob Johnson at 9/20/2006 6:29:56 PM
Using SQL Server 2005: How can I go about requiring NOT NULL data in columns - ONLY WHEN another column has a specific value? For example, given this DDL: CREATE TABLE [MyTable]( [ILoveToEmulate1950sFlatFiles_ID] [int] IDENTITY(1,1) NOT NULL, [Some_Varchar_Column] [varchar](50) NULL, ...more >>

Insert, Union, and Order By
Posted by David W at 9/20/2006 6:20:24 PM
I have a sproc that returns a paginated section of a list (say 20 rows from a list of 5000) and the total record count (the 5000). Typically I insert just the ids into a temp table with an identity column then select out the ids I need joining other tables to return the rest of the fields. T...more >>

Stored Procedures
Posted by Issy at 9/20/2006 5:24:01 PM
Does anybody know a good manual for learning how to build SQL stored procedures, views, user defined data types and user defined functions?? -- Issy...more >>

Difficulty with inner query and dates
Posted by Charles Calvert at 9/20/2006 5:06:29 PM
All, I'm using SQL Server 2000. I have a problem creating a query. Assume that I have a bunch of employees who are assigned to one of four floors in my department store. The assignments may change at any time and there is no predictable order to the changes. I have a table to track assig...more >>

Date Difference
Posted by Chamark via SQLMonster.com at 9/20/2006 3:56:40 PM
I know this is fairly easy for the Pro's, but I am having problems with differences between dates. I want to count number of employess who's date of hire is less than 7 months from the date range submitted for the query. Roughly Select Count(employees) from DB Where DOH is 7 months less th...more >>

Visual Studio 2005
Posted by dev648237923 at 9/20/2006 3:54:16 PM
When I develop Quesries using a Database project and making a new query (the 4 pane designer) the IDE always reformats my sql statements -- its unbearable! Is there any way to force it to leave the tabs, lines, etc. as I typed them? Thank you. ...more >>

T-SQL, HELP with Subqueries
Posted by CipherTeKST at 9/20/2006 3:12:01 PM
I have put together this query using multiple subqueries and when I click to parse query the command completes successfully but when I actually run the query I recieve a message stating Server: Msg 107, Level 16, State 2, Line 3 The column prefix 'ContactScheduler.dbo' does not match with a ...more >>

SQL Query help
Posted by wadefleming NO[at]SPAM yahoo.com at 9/20/2006 2:15:40 PM
I have a table PERSON with fields Name,Occupation. (both text fields) I want to write a query which returns the number of people employed, and the number of people that are not. ie: if Occupation has a value, the person is employed, if it is blank, they are unemployed. I am not sure how to m...more >>

Need to optimize update on linked server
Posted by Greg at 9/20/2006 1:11:17 PM
Here's a challenge for you SQL maniacs out there... I've got a stored procedure that updates a table on a linked server using values from a corresponding table on the local server. Here's the update statement I'm using today: update tr set tr.field1 = tl.field1, tr.field2 = tl.field2, tr...more >>

Concatenate Null Fields SQL Server 2000
Posted by Anonymous at 9/20/2006 1:04:01 PM
I hope I can explain this . . . I have several fields that can be null and I need to concatenate them together to create a single value. Not my data, so please understand it follows no logical rules. Here are the fields: Combined1: Null Element2: Null Combined2: 1111 Element3: 2222...more >>

Problem With Stored Procedure vs Direct SQL Call
Posted by taurin423 NO[at]SPAM gmail.com at 9/20/2006 12:49:43 PM
I have a table in SQL Server 2000 that has two columns, val (sql_variant) and datatype (varchar). I have the following query in a stored procedure. SELECT val FROM Items WHERE datatype = 'DateTime' AND MONTH(CAST(Items.val AS DATETIME)) = @month) When I call this using the stored procedur...more >>

trigger
Posted by vincent at 9/20/2006 12:35:01 PM
hello, i want to create a trigger that will do the following. once a record is inserted into my table1, it will take that same record and update one of it's fields from 0 to 1. the trigger will only update the last record added and won't edit any of my previous records already in the table....more >>

How to get YYYYMMDDHHMMSS
Posted by Rotciv at 9/20/2006 12:06:02 PM
Hi all, I am trying to store my datetime as YYYYMMDDHHMMSS. My first question is, should i store the date and time in different columns? Second question would be, how can i convert the time in SQL query to HHMMSS. thanks...more >>

How to use EXISTS key word in my query?
Posted by Learner at 9/20/2006 11:38:03 AM
Hello, Could some one please help me with my query. It works peice by peice but the only error I get is when I put it togater and that is how I want. Here is the Sql query I got ********************************************************************************************* SELECT * FROM ...more >>

Query - Use subquery in place of an expression
Posted by Uday at 9/20/2006 11:19:02 AM
Hi there, I have a webpage that calls a storedProcedure with @temp parameter ex: @temp = '1,2,3,4' --********************************** cretae proc usp_tt (@temp as varchar(12)) select * from t1 inner join t2 on t1.ID = t2.ID and t2.col in (Case ...more >>

how to do bcp in a table having identity column.
Posted by Amod at 9/20/2006 11:01:02 AM
Hi There is a table with definition as Table name t1 col1 char(4) null, col2 char(4) null col3 int identity To do bcp in this table I have created a format file like 10.0 3 1 SYBCHAR 0 4 "," 1 col1 2 SYBCHAR 0 4 "," 2 col2 3 ...more >>

Issues using stored procedure update
Posted by Darren at 9/20/2006 10:57:27 AM
I'd like to convert some code using direct SQL updates to stored procedures updates but... I don't want to update columns that aren't required for various reasons. Is it possible to create a stored procedure that only updates specified data columns using optional parameters? How can I tell ...more >>

Revenue split evenly into different quarters
Posted by sweetpotatop NO[at]SPAM yahoo.com at 9/20/2006 10:47:40 AM
Hello, I have a SQL question. I wonder if that can be done in a few line of code: Given an amount which will spread evenly across its start date and end date, say May 15, 2006 to Sep 30, 2006 How can I use sql to find out the amount in each quarter? In this case May 15 to June 30's amo...more >>

Strip out Alpha Character
Posted by angela.y.austin NO[at]SPAM gmail.com at 9/20/2006 10:34:17 AM
I'm importing a 10 character zipcode field with a "-". I'd like a command that only imports only numberic characters. Can anyone help? I'm currently using LEFT(ZipCode, 5) + RIGHT(ZipCode, 4), but would prefer to use something more efficient. Thanks for your help! ...more >>

Possible to create a sql server 2005 table from an xsd file?
Posted by keithb at 9/20/2006 9:53:13 AM
Just wondering if there is a utility or stored procedure that will create a table based on and xml schema file. Thanks, Keith ...more >>

Need help with a query.
Posted by Learner at 9/20/2006 9:51:33 AM
Hello, How can I get the following query working? create table testtable(testcolumn varchar(10)) GO insert into testtable values('-') insert into testtable values('1,5') insert into testtable values('.') insert into testtable values('9,5') insert into testtable values('-') insert into...more >>

Connection string at asp.net app for data mirroring
Posted by dz0001 NO[at]SPAM gmail.com at 9/20/2006 8:53:31 AM
I set up database mirroring with Principle, Mirror and Witness, turn on the auto-failover, everything works. But we have asp.net application using .net framework 1.1, I am trying to use Failover Partner key words in the connection string of web.config file, but get error saying "Failover Partner...more >>

Triggers and Stored Procedures
Posted by Nick T at 9/20/2006 8:43:02 AM
I want to limit the deletion of rows in a table to a specific stored procedure. Is there a trigger that can constrain this, or, something else which will solve this. This is for SQQ Server 2000. Thanks -- Regards Nick T...more >>

How do I Replace Strings in SQL
Posted by Matthew at 9/20/2006 8:31:53 AM
Rules All should be case insensitive DELETE any = CPU DELETE any = family DELETE any = Processor DELETE any (TM) DELETE any (R) DELETE words that meets the criteria ####MHz or ##.##GHz The last one is the tricky one. Everything else should be title case. Examples: Intel(R) Pentium(R)...more >>

export SPs using 2005
Posted by Chris at 9/20/2006 7:01:45 AM
This was trivial task in Enterprise Manager. How do you export all your create scripts in SP 2005? Thanks Chris...more >>

Need help using converting function in a SQL query
Posted by Learner at 9/20/2006 6:37:52 AM
Hello, I have a table column with the below values -------------- |testColumn | -------------- | - | | 1,5 | | . | | 9,5 | | - | | . | -------------- I need to make 0 (zeros) where ever a '-' or '.' present and ...more >>

truncate issue
Posted by rodchar at 9/20/2006 6:35:01 AM
hey all, i'm trying to truncate a table of mine but it's saying it can't because foriegn key reference. is there a way to force it, if not how would i make this happen? thanks, rodchar...more >>

Using If Statement in a Function that Returns a Table
Posted by billharrison9 NO[at]SPAM gmail.com at 9/20/2006 5:41:40 AM
I am relatively new at T-SQL and would appreciate some advice on the following. I have a function that returns a table. I need to make the where statement conditional, returning all values if the user is part of a group. I am able to test membership in the group with the following: IF (IS_M...more >>

time since last application
Posted by blueboy at 9/20/2006 5:30:17 AM
Hi im wondering if anyone can help me im trying to write a slq view which will tell me the days in between a client and the previous application they have done here is the SQL i have so far SELECT ARN, entity.ID, convert(varchar(10),V_current_status.start_date,103) as Start_Date, convert(n...more >>

WHAT IS THE EQUIVALENT OF EVALUATE() FUNCTION IN SQL
Posted by Dinesh at 9/20/2006 4:07:01 AM
hi, i am trying to run a sql statement where i want a column in a table to be compared to the value contained within a variable. how do i achieve? eg. if i want to look for TABS in a column mchrval=9 SELECT * FROM mytable WHERE CHR(mchrval) IN table_column thanks in advance. rgd...more >>

SQL Server Integration Services Expression
Posted by rocket salad at 9/20/2006 3:58:02 AM
I'm experimenting with SSIS at the moment and I'm having a problem with an expression. I have defined an oledb data source and selected a table from that. I have then dragged a derived column object into the workspace. I want to create a column which is an integer representation of the numb...more >>

ORACLE database update trigger
Posted by Chris at 9/20/2006 3:45:52 AM
Hi, I am relatively new to databsae triggers and I am currently having a problem with an UPDATE AFTER trigger. I am using Forms 6i to perform a few calculations and then commit then to the database. When these records have been updated in the database (AFTER UPDATE) i want to create a trigg...more >>

Another SQL Query Question : TOP 1
Posted by .. NO[at]SPAM at 9/20/2006 2:17:37 AM
Here's a query... it is between three tables SELECT DISTINCT dbo.products.manufacture_code, dbo.phoneManufacturer.idPhoneManufacturer, dbo.products.active, (SELECT TOP 1 idCategory FROM dbo.categories_products ...more >>

select query
Posted by joshua siew at 9/20/2006 2:15:02 AM
Dear all, Appreciate your help! got me some simple query problem need solution for this data, Pallet_id --------- 12D7J14513A 12D4F15023A 12D4F15002A 12D4F15002B 12D4F15002C 12D4D15014A 12D2R14919B 12D2R14919A output should be this 12D7J14513A 12D4F15023A 12D4F15002C 12D4D150...more >>

Stored Procedure/View to generate a new list of records.
Posted by ben.bartle NO[at]SPAM gmail.com at 9/20/2006 1:51:18 AM
Hey guys, I am trying to write a view/set of views, on an existing table, to give me a new set of records in a view. Here is a simple representation of the source table: RecordID (GUID) | Date1 | Amount1 | Date2 | Amount2 | Date3 | Amount3 | ..... | Date12 | Amount12| So basically, the...more >>

generate a list of dates, better way of doing it
Posted by codefragment NO[at]SPAM googlemail.com at 9/20/2006 12:39:50 AM
Hi I'm using the query below to generate a list of dates by (1) generating a table of 400 numbers (2) using dateadd to get the dates This is in MS Server 2000 I'm new to SQL so I appreciate this probably isn't the best way to do it but in terms of specifics (1) I use 1>0 in the join beca...more >>

Data transfer between databases with different structures
Posted by Elegba at 9/20/2006 12:01:22 AM
This should be pretty straight forward to any SQL guru out there, but not really my forte. So would appreciate any help Ok say we've got two databases with two tables and we need to transfer data from one to another. However, the data structure in sourceDB is different to targetDB. Better to i...more >>

SQL function return table
Posted by ken at 9/20/2006 12:00:00 AM
hi all, I have create a self-define SQL function (say fn_OrderID, in MSSQL2000), which pass a parm (say OrderID) then return a table (say all item, price, invoice_date of the specific OrderID). It runs okay then I pass the parm one by one, which reutrns the record set correctly. like t...more >>

Passing and using an array of values to be used in an in statement
Posted by Robert Bravery at 9/20/2006 12:00:00 AM
HI all, I am being passed a list of values in an array of sorts eg '1,3,7,9,11,13,17' I have a SP that in it makes a select statement with an in statement someting like select * from dimension where dimID in (1,3,5,7,9,11,17) But I want to parametise the in statment, something like select *...more >>


DevelopmentNow Blog