all groups > sql server programming > march 2004 > threads for tuesday march 30
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
VBScript and an INT column - how to "show all"?
Posted by Nathon Jones at 3/30/2004 11:25:24 PM
Hi,
I have a menu, with a list of months. I want to include an option "Any"
which, if selected, will display results from all months ("any" month).
It it were a text field, my "Any" option in the menu would have a value of
"%" - what do I need as the value when working with an INT column?
... more >>
Distinct Members In Every Month
Posted by Deepak at 3/30/2004 11:21:10 PM
Hi
I need to display each and every month and total customers shopped in a , say a supermarket by month and the new members shopped in very month in other column i.e the members shopped in a month which is not in the previous mont
The Tabe is something like this
Member transaction_date ... more >>
Static SQL v/s Dynamic SQL in Stored Procedures
Posted by PVV30 at 3/30/2004 11:21:08 PM
Hello
What are adv / disadv of using Dynamic SQL against Static SQL in stored procedures
Regards
PVV30... more >>
large nvarchar index consideration
Posted by Guy Brom at 3/30/2004 10:45:35 PM
Hi all,
I have a nvarchar(25) field (user_name) which I want to create as index.
This is proarbly the most used column on my entire application, as it uses
to check login and session details on every webpage.
What is the best index to create?
Should I go with a user_name_checksum and crea... more >>
Comments?
Posted by Martin Hellat at 3/30/2004 9:56:07 PM
Hey
Is there any way in sql server 2000 to add a comment/description to tables/columns? like in oracle 'add comment'
Thanks in advance
Martin... more >>
How to debug stored procedure in sql server
Posted by Iter at 3/30/2004 9:16:08 PM
How to debug complicated stored procedure in sql server query analyzer or Profiler. I can set break point,stop there, can see the value of variable. thanks
... more >>
Full text search catalog
Posted by Murtix Van Basten at 3/30/2004 8:35:42 PM
Hi,
I am using a full-text catalog to perform search inside a 1GB table. I
have created fulltext catalog as usual methods, selected the necessary
fields for the catalog from the table. When I want to make a stress test
over the search fucntion, it deoesnt return any data if I use more then... more >>
Help with constraint
Posted by Star at 3/30/2004 6:32:39 PM
Hi
I have 4 fields like this
CREATE TABLE [Subs_Addresses] (
[Name] AS (coalesce([StreetName],'') + ' ' + coalesce([City],'') + ' ' +
coalesce([State],'')) ,
[StreetName] [varchar] (255) NULL ,
[City] [varchar] (50) NULL ,
[State] [varchar] (40) NULL
....
}
As you can see, Nam... more >>
Don't see what you're looking for? Search DevelopmentNow.com.
Formatting datetime to MMDDYYYYHHMMSS
Posted by Jeff Dillon at 3/30/2004 5:47:34 PM
I could use datepart for each piece and concatenate, but is there a more
elegant way to format a datetime field to MMDDYYYYHHMMSS?
Jeff
... more >>
Table/Pky in separate filegroups
Posted by Simon at 3/30/2004 5:36:50 PM
Can I separate a table and it's primary key to
separate filegroups
I have a table that I'd like assigned to filegroup "X"
I have a primary key that I'd like assigned to filegroup "Y"
I create the table and all is well. When I create the primary
key, the table gets dragged to the pk's fi... more >>
Good Third party tools to replace SQL Query Analyzer?
Posted by Mark Andrews at 3/30/2004 5:34:50 PM
Looking for a good tool to build views, stored procedures etc... (similiar
to SQL Server Query Analyzer) that works with SQL Server and Oracle.
Any suggestions would be appreciated,
Mark
... more >>
Help in UPDATE and JOIN
Posted by Prabhat at 3/30/2004 5:22:52 PM
Hi all,
I have used the below CURSOR to Update the "PAYMENTCOUNT" field of the
ACMAST table.
This is working fine. But has a BIG PERFORMANCE Prob. As My Table has
5,00,000 Records.
So Please Suggest How can I write a Single Update Statement using JOIN to DO
the SAME JOB.
set nocount on
... more >>
update query
Posted by chris at 3/30/2004 4:38:15 PM
sql2k sp3
I want to update a table simply by adding '00' to the
exisiting values in that table. Heres my crack at it:
update AccessStores
set StoreId =
(select '00' + StoreId from AccessStores
where StoreId like '[0-9][0-9][0-9]')
but I get the Subquery returned more than 1 value... more >>
Cascade Delete not working
Posted by Aaron Prohaska at 3/30/2004 4:33:32 PM
Can anyone tell me why cascade delete doesn't work when I delete a
customer from the Customers table? What is happening now is that when a
customer is deleted the records in CustomerCreditCards, CreditCards and
ShippingAddresses are deleted, but the any of the records in the
Addresses table.... more >>
@@Error Issue
Posted by Tuoc at 3/30/2004 4:26:10 PM
Hello all
Please help , I have the following:
CREATE TABLE [AbraDataDictionary]
[ID] int COLLATE SQL_Latin1_General_CP1_CI_AS NULL
[Description] [varchar] (1000) COLLATE SQL_Latin1_General_CP1_CI_AS NULL
G
INSERT INTO AbraDataDictionary VALUES ('A','Testing
IF @@ERROR <
print 'Err... more >>
IN statement with variable
Posted by Fredrik Melin at 3/30/2004 4:14:15 PM
Is it possible to get this code working?
DECLARE @sTEMP AS VARCHAR(200)
SET @sTEMP = '123,123,123,212'
SELECT TOP 10 * FROM INVENTORY WHERE GROUP_ID IN (@sTEMP)
@sTemp is a variable containing the group_id, normally its only one, but
sometimes there is more then one, Can you somehow use var... more >>
localization issue and defaults
Posted by Guy Brom at 3/30/2004 3:59:14 PM
Hi guys,
I have a multilanguage table (tblLabel) with a suitable labelText for every
labelLang (1= English, 2= French, 3= Spanish). Similiar texts (different
language) are grouped with the same labelGroup.
For example-
[labelGroup] [labelLang] [labelText]
1 1 ... more >>
How to store parameters of a stored procedure.
Posted by Gopinath Munisifreddy at 3/30/2004 3:37:56 PM
Hi,
I want to store all the parameters of a sp. How can i store them in a
table(so that i call call the sp with same values). Allmost all my sp's take
40-60 parameters. These sp are called during replication process. When any
error occurs in a sp i want to store parameter of the sp in a so... more >>
3 column Order By clause in an S-Proc
Posted by Gary D. Rezek at 3/30/2004 3:37:12 PM
Hi All,
Please forgive the clumsiness of the following.
I have an ASP page which will be used as a "filter-handler" to sort and filter through necessary network port info. On that page
I have 3 "FilterBy" text boxes (1, 2, and 3) and 3 "OrderBy" text boxes (1, 2, and 3), along with 3 "SortBy" tex... more >>
Using stored procedure as table source in FROM clause
Posted by AndrewH at 3/30/2004 3:36:12 PM
Hello all
I'm looking for a way to use the resultset from a stored procedure as the 'table' in the FROM clause of a select query
For example, lets say I have a stored procedure called some_sproc which takes a single parameter in
What I'd like to do is this
select *
from some_sproc(val1)
I... more >>
- Logical Scan Fragmentation
Posted by - Dan - at 3/30/2004 3:34:16 PM
What does it mean when "logical scan fragmentation" is missing from the
results of DBCC SHOWCONTIG (tablename) WITH ALL_INDEXES?
... more >>
problem with loop
Posted by chris at 3/30/2004 3:31:06 PM
hi
i have the proc belo
create procedure testt
@productNumber varchar(10
a
declare @varIssue varchar(10
declare @retCoverDate varchar(10
declare @returnVal varchar(10)
DECLARE @sql NVARCHAR( 2000 )
@SQLx NVARCHAR( 2000
-----------loop begin
----------here it is getting ... more >>
Passing parameter set to StoredProc
Posted by CJM at 3/30/2004 3:16:31 PM
I want to run a query in a SP along the lines of:
Select * from [table] where field in ('val1', 'val2', 'val3')
How do I pass the list of parameters through? We have an small but unknown
number of these.
I tried passing through a single string but it doesnt work - fails
converting the str... more >>
Convert to Varbinary
Posted by Sammy at 3/30/2004 2:57:38 PM
Hi -
I have a sql as follows:
update table1
set field2= convert(varbinary(32),'NDYRIRUSIDJE=')
where field1 = 'test123'
Field2 is defined as a varbinary on the table. This
works fine in SQL Query Analyzer. I then set this up as
a stored procedure as follows and it does not convert.
... more >>
What is the max number of columns in a table of a SQLXMLBulkLoad
Posted by James Chin at 3/30/2004 2:46:08 PM
I am importing a table of about 940 columns and I always get an error
<?xml version="1.0"?><Error><Record><HResult>0x80004005</HResult><SQLState>01000</SQLState><NativeError></NativeError><ErrorState>1</ErrorState><Severity>0</Severity><Source>Microsoft OLE DB Provider for SQL Server</Source><Desc... more >>
Dynamic Sql
Posted by A.M at 3/30/2004 2:41:36 PM
Hi,
Could anyone refer me to resource that compaires advantages and
disadvantages of dynamic sql?
Long time ago I saw some white paper called "the curse and blessing of
dynamic sql", but I can not find it now !!!
Any help would be apprecited,
Allan
... more >>
linkserver error
Posted by SQL Apprentice at 3/30/2004 2:12:28 PM
Hello,
I created a job that uses a linkserver to Oracle db for the past year.
It ran fine until a few days ago when Oracle db schema changed.
I modified my SQL schema to be the same as theirs but I am still getting an
error.
I ran the following on Query Analyzer.
SELECT *
FROM OracleSe... more >>
Select top records
Posted by simon at 3/30/2004 2:07:14 PM
I have parameter @count in my SP.
Now I would like to get top @count random records from my table.
Something like this:
CREATE PROCDURE test
@count int
AS
SELECT top @count FROM myTable ORDER BY newId()
How can I do that?
If I write:
SELECT top 5 FROM myTable ORDER BY newId()
... more >>
Table design with nullable columns
Posted by dwight NO[at]SPAM trumbower.com at 3/30/2004 1:19:17 PM
I'm reviewing a db design and the tables have quite a few columns that
are nullable. What are some design varitions that could eliminate
tables with many nullable columns? Links to more reading are
acceptable.
I know some of it could be eliminated by normalizing further. Which I
would guess i... more >>
Can't Figure This Out
Posted by Wayne Wengert at 3/30/2004 1:06:42 PM
I am having a problem with the following query. It should return values from
two different units (Banderas and Genesis) but it only returns the Genesis
matches. I cannot see why? Any pointers appreciated.
Wayne
================== Query =====================
SELECT t1.UnitName, t1.Unit... more >>
order by?
Posted by Richard G at 3/30/2004 12:47:33 PM
The "order by" clause does not recognize table prefixes in some cases. The
result order is different even though the same "order by" column is used.
Ordering is using the "select list" column in the first query, and the
result is in the stated "order by" order in the second query. Is this by
d... more >>
trigger problem
Posted by chris at 3/30/2004 11:51:11 AM
hi
i am having problem with this trigge
USE PO
IF EXISTS (SELECT name FROM sysobject
WHERE name = 'updlogpos' AND type = 'TR'
DROP TRIGGER updlogpo
G
create Trigger updlogpo
O
PO_Data_Fil
FOR Updat
a
begi
insert into log_pos
(id,col1,col2
SELECT 'OLD'
id,col1,col2 FROM P... more >>
ISNULL in WHERE clause
Posted by Gerard at 3/30/2004 11:50:34 AM
Hey all,
An easy one, I am running SQL 2k on Win 2k Server.
How do I search for a null condition in the WHERE clause.
An example:
SELECT tblWhatever.AudType,
tblWhatever.AudDate
FROM tblWhatever
WHERE (ISNULL(tblWhatever.AudDate, NULL) LIKE 1)
This doesn't work. How can I filter... more >>
find a value in database
Posted by joe at 3/30/2004 11:31:23 AM
Hi, I have a bunch of tables in database. I need to find out which tables
contain values "wsbook", is it possible or no?
Note: it's not table names, "wsbook" is data from tables
... more >>
Running dynamoc SQL code
Posted by Eric D. at 3/30/2004 11:25:58 AM
Hi,
I want to run an SQL statement that I have generated and
stored in a VARCHAR variable.
I want to be able to run the statement and store the
output of that statement in a temp table.
I've tried different variations of code (ie. using EXEC)
to accomplish this, but nothing seems to b... more >>
simple delete statement runs forever
Posted by Mike Kanski at 3/30/2004 11:08:38 AM
I have a table with about 1.2 mil records.
When i issue a delete statement like that:
delete from table
It runs forever. Clustered Index scan is performed by Sql Server!
How to avoid index scanning by Sql Server?
Table Definition:
OID(int), Lname(varchar(50)), Fname(varchar(25), Zip(... more >>
Repost: Possible SQL Query Analyzer memory leak or other problem
Posted by baolinren NO[at]SPAM hotmail.com at 3/30/2004 11:01:40 AM
I posted this message last week and got some responses and I thank for
the resposes again over here. Unfortunately, I have not received an
answer to the question I am concerning. Following are the previous
messages. I am hoping someone, especially who is from Microsoft, could
give me an answer.
... more >>
Stored procedure question
Posted by Jason Hurder at 3/30/2004 10:52:54 AM
Hey folks!
I've created a query within a trigger that returns a number of records. I
need to insert these records into another table. However, I haven't been
able to figure out how to retrieve anything other than the top record. I
know you can set a while loop up in a stored procedure, but how... more >>
Trigger with aggregate possible ?
Posted by Mark M at 3/30/2004 10:52:46 AM
Trigger newbie
I need to auto increment a Column that is an int datatype and is not
the PK
I am currently dealing with this in the front end but have worries
about concurrancy issues and would like to handle this in the backend.
Is this possible with a trigger using an aggregate statement... more >>
Small SQL-Puzzle
Posted by Lasse Edsvik at 3/30/2004 10:08:35 AM
Hello
following puzzle i got help solving long time ago but i cant find it
anywhere, i guess newsgroupservers doesnt store every message.....
anyway...... if wayne snyder (i think it was) or some guru could help me
solve this one again i would appreciate it very much.
if i can remember it c... more >>
xp_sendmail and excel column formats
Posted by Tim at 3/30/2004 9:35:38 AM
I've been fooling with this for a couple of days now and can't figure it
out. The first column in my query is a 10 digit order number. Excel is
considering this column as numeric and converting it to scientific notation.
I've tried adding double quotes to before and after the values and single
... more >>
How to read/write binary data from/to SQL server?
Posted by Kevin Dai at 3/30/2004 9:29:01 AM
Hi, all:
How to read/write binary data from/to SQL server? Could please give me an
example?
Thanks in advaince
kevin
... more >>
Converting hex number to integer
Posted by Francois Piette at 3/30/2004 9:16:03 AM
I would like to convert a string representing an hex number to an
integer.Unfortunately the CONVERT function doesn't like CHAR or VARCHAR.
SELECT CONVERT(INT, 0x1AB2) works very well but
SELECT CONVERT(INT, "0x1AB2") gives an error message.
btw: In my real problem, "0x1AB2" comes from a SUBS... more >>
Writing a .Net app to controll DTS packages
Posted by Jim Covington at 3/30/2004 8:58:08 AM
Is there a way to incorporate DTS package execution using vbDotNet ?
If so point me to some examples.
Thanks
Jim
... more >>
connection specific variable
Posted by Rob Balcer at 3/30/2004 8:32:55 AM
Can you
- Define
- Set
- Access
a connection specific variable that exists for the
duration of a session?... more >>
Stored Procedure Monopolizing SQL Server Resources
Posted by dweingarten NO[at]SPAM firstam.com at 3/30/2004 7:56:05 AM
We have a stored procedure that generates a rather complex report on a
daily basis. The query is very resource intensive and causes other
OLTP processes to time out due to extended delays. We have tried to
optimize the query as much as possible, but it still seems to cause
problems. The same ... more >>
Call User-Defined Function within a User-Defined Function?
Posted by Lawrence at 3/30/2004 7:36:05 AM
Is this allowed? Also, is returning Table from a User-Defined Function a resource-saving (efficient) way of writing code? Or is there a better alternative
thanks
-Lawrence... more >>
EXEC in UDF
Posted by Eric D. at 3/30/2004 7:17:30 AM
Hi,
Can you use the EXEC function in a UDF?
TIA,
Eric... more >>
Validate File Upload Duplication
Posted by ranji abraham at 3/30/2004 6:17:58 AM
Greetings,
We load accounting data contained in delimited text files via a web =
interface to a SQL 2000 DB. Each record in the file contains a person =
id, some accounting information and an amount. Files typically contain =
about 20,000 records. Each file is assigned a unique batch ID when i... more >>
Split function in SQL?
Posted by (obakush NO[at]SPAM osfi-bsif.gc.ca) at 3/30/2004 5:51:22 AM
Does anybody know an easy way to split a field based on delimeter in SQL? I.e. I need to split
field1='{1,2}{2,3,4}{2,6}' into 3 fields:
1,2
2,3,4
2,6
May be by ising PATINDEX('%{_}%', field1)? Do I have to create cursor for it or there is an easier way?
Any ideas would be appreciated.
**... more >>
Execution of stored procedure hangs
Posted by Ernie Gregory at 3/30/2004 5:28:56 AM
Can anyone explain this ?
I am trying to gather data, including version number, for
a number of remote servers, running MSSQL2000, by
executing the sp xp_msver, and loading the result into a
temporary table.
The code looks like this:
<<
Set @ExecString = rtrim(rtrim(@ServerName)
+ ... more >>
isnumeric
Posted by Rob at 3/30/2004 5:10:15 AM
Hello All,
Why would these two statements return different results?
select isnumeric('0403267d2')
select isnumeric('0403267c2')
The first one returns 1 which from my understanding is
incorrect. The second returns a 0.
Any comments are appreciated.
R... more >>
Table Information
Posted by James Proctor at 3/30/2004 4:49:29 AM
Hi,
I was wondering is there a way i can query a database to find out what
tables there are in the database which are user created, then using
something like vb loop through to find out details of each table in
turn, i.e. Table size, rows that kind of thing. Ive been searching all
over the ne... more >>
Simple question (?)
Posted by Knut Lissen at 3/30/2004 4:16:08 AM
How do I extract the AUFNR values from table #ImportWO that are not in table #WO
(Correct result would be: 001, 005, 006
CREATE TABLE #ImportWO
AUFNR nvarchar(12) NOT NULL
B int -- not relevan
CREATE TABLE #WO
A1_WO_NO nvarchar(12) NOT NULL
B int -- not relevan
INSERT INTO #Imp... more >>
join queries with uniqueidentifier
Posted by William Ortenberg at 3/30/2004 3:37:57 AM
I've encountered a seemingly strange problem. I have a table with a column
of type uniqueidentifier. I can query the table using the field in the
WHERE clause, comparing to a string. For example:
SELECT * FROM TableA WHERE UID = 'adadsfadsfadsfadsf'
However, if I attempt to join a table w... more >>
Views
Posted by Puneet at 3/30/2004 3:11:09 AM
I have created a view which picks up data from another view, i would like to have a structure in the view like if i can use if then else or atleast if then statements
i need to get the dates compared with getdate() function
... more >>
Updating Table with Info From Another One
Posted by Johns at 3/30/2004 3:11:05 AM
I have two tables
Table One:
Has Customer Number, Customer Name, Sales Order Number , Address Code, Address Details, City, Postcode and a distinct Shipment Number
This table only has details which are fixed when a customer is setup initially
Table Two
Has Customer Number, Customer Name, Sales O... more >>
Updating >8000 char Ntext Gives me a Lock:Timeout
Posted by Lucas Tam at 3/30/2004 2:49:22 AM
I'm having timeout issues updating a Ntext field that is >8000 chars.
In SQL Profiler, I am geting a Lock:Timeout when updating a row with > 8000
char Ntext field.
I can update any row with a text field of less < 8000 char.
Anyone know why SQL server will be timing out? Is there someth... more >>
are functions that slow?
Posted by Guy Brom at 3/30/2004 2:02:31 AM
I have a function that converts a varchar to a bigint using a set of rules.
when I try to use that new bigint, the query is about 10 times slower then
if I supply the query with the bigint directly. for example:
SELECT CountryCode
FROM Countries
WHERE IP_FROM>=dbo.IPToBigInt('194.90.1.5')
AN... more >>
|