all groups > sql server programming > may 2005
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
T-SQL Update statment moore information
Posted by AJ at 5/31/2005 11:37:01 PM
Giving moore information about my problem....
SQL Server 2000 enterprise (sTABLE have only 3 records)
Sample:
select convert(varchar,getdate(),114)
update sTABLE set COLUMNcounter=-9 where COLUMNkey=110100100001
select convert(varchar,getdate(),114)
------------------------------------... more >>
Reflective linking
Posted by news.microsoft.com at 5/31/2005 11:11:13 PM
Greetings.
I want to create a tree control which will list all the employees in an
employee table in the correct hierarchy like
<company>
managers
sub managers
employees
For that, how can I setup reflective linking (linking ot the same table) in ... more >>
alter table
Posted by Big D at 5/31/2005 10:07:06 PM
Using the alter table command i create a new column on a existing table.
When I creater this new column I want to set the default value as 0. For
some reason the column name is null.
SQL statement:
ALTER TABLE [dbo].[DMINFORMATION] WITH NOCHECK ADD
[ACTIVEFLAGS] [bit] DEFAULT ((0))
An... more >>
T-SQL Update Performance
Posted by AJ at 5/31/2005 9:42:03 PM
I have a update query, updating 1 of 3 records in a table. But that update
spend 17 miliseconds to end the job.
That is normal??? it's a normal performance to SQL Server??
Cuz, I need to reduce that period of time, reduce 17 milisecond to 2 or 3
miliseconds.
That's is possible with S... more >>
CRecordset consumes SQL Server Memory
Posted by Jason Wood at 5/31/2005 9:28:03 PM
I have an MFC app with a thread that uses a ODBC consumer class to access a
SQL server. When I write the code different ways I get different results and
don't know why.
Example 1:
threadFunc()
{
CtblMyTable myRecordset(NULL);
while( !kill )
{
myRecordset.Open();
... more >>
controlling database access
Posted by Shaun Wilde at 5/31/2005 9:09:05 PM
Hi All
I have a scenario where I have several processes (web-farm) that try to
process data in a certain table. I'd like to control access such that only 1
row from the table can be processed at a time regardless of how many
external processes try to access it. I guess I need to lock access so... more >>
Performance With Update Sentence
Posted by AJ at 5/31/2005 8:38:04 PM
I've an update sentence, that do the update in 17 miliseconds. That's its a
normal performance..... because I need to reduce that period of time to 2 or
3 miliseconds.
Thanks.
God bless you... more >>
SQL Conditional Statements!
Posted by AJ at 5/31/2005 7:39:19 PM
I have a requirement which i am hoping to accomplish with a stored procedure.
LOGIC:
1) retrieve a record from db
2) if no record is returned set var to 1
3) if record is returned set var to record value + 1
Here is my attempt so far:
DECLARE @attempt_nbr INT
SELECT attempt_nbr FROM ass... more >>
Don't see what you're looking for? Search DevelopmentNow.com.
SQL Capability Question
Posted by Solel Software at 5/31/2005 5:12:06 PM
Hi,
I have a general SQL capability question. If have the table
CREATE TABLE People
(person_id INTEGER NOT NULL PRIMARY KEY,
name VARCHAR (35) NOT NULL,
LastLogin datetime
);
with
--
Sincerely,
Mark Fox... more >>
Hiding NULL columns from result set
Posted by keber at 5/31/2005 5:09:20 PM
Hello colleagues, I have the following table, that has two flags - show
quantity, price or both. If a flag is not set I would like the corresponding
column to not be included in the result set.
CREATE TABLE Table1 (
Id int IDENTITY (1, 1) NOT NULL ,
Name nvarchar(20) NOT NULL,
Qty int N... more >>
Forward copying log data
Posted by Thom Anderson at 5/31/2005 5:03:34 PM
I have a profile table of accounts that contains some data for each month.
Months are stored as INTs so in my example below, consider "35" to be
whatever you want, like January 2005. I have a web tool that users can use
to log changes to the accounts. One such item is the change in sales rep... more >>
fast query
Posted by Chris at 5/31/2005 5:01:10 PM
Hi,
What the best and fast way to check if a table has rows?
Thanks
... more >>
Interesting join
Posted by Cipher at 5/31/2005 4:45:43 PM
I'm looking for some guidance on how to create a join between two tables
given the following...
Table1
ID SeqNum
A 1
A 2
B 1
B 2
B 3
Table2
ID SeqNum
A 33
A 36
B 66
B 67
B 99
The problem here is that... more >>
Need help with update/select statements please.
Posted by Lam Nguyen at 5/31/2005 4:21:52 PM
Hi all,
I have the following data and need to clean up all the junk data and keep
the valid Lastname and FirstName. Please
see the result want below. Thank you very much in advance.
IF OBJECT_ID('Tempdb.dbo.#Temp', 'u') IS NOT NULL
DROP TABLE #Temp
GO
CREATE TABLE #Temp
(
... more >>
How to duplicate a database?
Posted by Quentin Huo at 5/31/2005 4:21:42 PM
Hi:
I have a database for my asp.net application and now I want to create
another database with everything same, including the data, except the
database name(this database will be used by another asp.net application).
How can I do this programmingly? I am using C#.
Thank you very much!... more >>
Doing a Transaction Log Backup.
Posted by Craig HB at 5/31/2005 4:11:53 PM
I am going to back up my databases using a Database Maintenence Plans (from
Enterprise Manager). I see there is a Complete Backup and a Transaction Log
Backup.
If I do a Complete Backup, should I do a Transaction Log Backup as well ?
What would you do a Transaction Log Backup ?
Thanks... more >>
Suggestion for table design
Posted by siaj at 5/31/2005 4:09:07 PM
Hello All,
I am designing a table for rules of insertion into a different table.
I have criterias like Bank no., Branch No. Region code.
The Rules are like
If Bank No. > 23 and Branch No between(10,20) and Region code not
between(5,9) then the value is "A"
OR
If Bank No. between(12,18... more >>
query help with COUNT
Posted by Mike at 5/31/2005 4:08:54 PM
Hi,
I am trying to add an aggregate function to my query below and I am not
getting the right results. My intention is to get the count of the files
downloaded by each user but my query only returns the total downloads by all
users. I really appreciate your help
(I am using this query in a s... more >>
Relationship across databases
Posted by Ed at 5/31/2005 4:08:34 PM
Hi,
Is there anyway I can create a relationship across different databases or
even show it on a diagram?
Thanks
Ed... more >>
Error converting data type nvarchar to int (when calling a proc)
Posted by JohnnyMagz at 5/31/2005 4:07:20 PM
I have a proc that takes three ints as input params and returns the value of
@@error (in a var named @errorCode). The proc works when I pass it constants,
but fails with the error "Error converting data type nvarchar to int" when I
attempt to pass it variables. Here's how I attempted to call i... more >>
How can I launch a plain file with DMO?
Posted by Enric at 5/31/2005 4:06:19 PM
Dear fellows,
I've got a plain file (200 mb!) which contains something like this:
insert into tmpEnric(cod,desc) values(1,'bcn')
insert into tmpEnric(cod,desc) values(2,'rom')
insert into tmpEnric(cod,desc) values(3,'mad')
....
up to almost infinite...
Problem is the following: quer... more >>
complex query help - count
Posted by Mike at 5/31/2005 4:00:06 PM
Hi,
I am trying to add an aggregate function to the query below but I am not
able to get the intended results. I want to get the count to return total
downloads by each user but my query returns the total downloads by all users.
Current Output
1,ttt,rrr,6/1/3005,30
2,ddd,jjj,5/31/2005,30
... more >>
Query as shortdatetime field
Posted by Barley Man at 5/31/2005 3:45:45 PM
I am very new to sequel server and am accessing for the first time. I have
found that I can interrogate a 'table' where a field called orders.order_date
is in shortdatetime by:-
select * from orders where orders.order_date = '1 FEB 2005'
What are the 'acceptable' 'wordings' for
'1 FEB ... more >>
Performance help
Posted by Chris at 5/31/2005 3:40:56 PM
i have the foll id's (sample 2005053110073148) generated by a function. I
need to store the data in a table. What is
the best datatype should i give to the column to enhance performance and
storage.
Thanks... more >>
complex query help - count
Posted by Mike at 5/31/2005 3:38:17 PM
Hi,
I am trying to add an aggregate function to the query below but I am not
able to get the intended results. I want to get the count to return total
downloads by each user but my query returns the total downloads by all users.
Current Output
1,ttt,rrr,6/1/3005,30
2,ddd,jjj,5/31/2005,30
... more >>
How can I launch a plain file with DML instructions inside?
Posted by Enric at 5/31/2005 3:33:56 PM
Dear fellows,
I've got a plain file (200 mb!) which contains something like this:
insert into tmpEnric(cod,desc) values(1,'bcn')
insert into tmpEnric(cod,desc) values(2,'rom')
insert into tmpEnric(cod,desc) values(3,'mad')
....
up to almost infinite...
Problem is the following: quer... more >>
can't debug SP in VS 2003
Posted by Oleg Bulay at 5/31/2005 3:31:05 PM
I can't debug SP in VS 2003
My config:
* Windows XP Pro
* VS.NET 2003
* SQL Server 2000 SP3a
* Breakpoints are not hit in stored procs either... they become question
marks when I run and the tooltip text says "The breakpoint will not
currently be hit. Unable to bind SQL breakpoint at th... more >>
Trying to use a user defined function in a view
Posted by Dennis at 5/31/2005 2:36:53 PM
Trying to use a user defined function in a view
I want to pass values by name to the udf
CREATE View MyViewAS
SELECT
udf_MyUdf (40,30,@MyValue=3D'SOME INFO) AS ['MyCalcColumn"],
OtherCollumns
FROM MyTable
I get=20
Must declare the variable '@MyValue'
which is declared in the d... more >>
Yukon and SourceSafe 2005
Posted by Amos J. Soma at 5/31/2005 2:21:46 PM
I'm not sure if this is the correct forum to ask this, if not, please
redirect me.
I understand that Yukon will allow us to check schema objects in and out of
SourceSafe 2005. This is great news. Is there (or will there be) anyway to
quickly load all the schema objects of an existing databa... more >>
need helps to change object owner...
Posted by === Steve L === at 5/31/2005 2:10:49 PM
background: sql2k on win2k3 box.
security: mixed
i have developers created tables with their domain acct. (like
MyCompany/Usr)
i tired to change the table ownership by the following command but got
errored out.
sp_changeobjectowner 'table1', 'dbo'
error message:
Object 'table1' does no... more >>
Date Syntax
Posted by Mark A. Sam at 5/31/2005 1:53:26 PM
I am modifying ASP Script to work with an SQL Server table. It was
originally designed for Access.
No errors arise which is why I can't figure this out.
The following snippet runs when a date is selected on the form.
else
q = q & " (DateLoading = " & dateavail & ")"
This results in ... more >>
simple query help
Posted by james at 5/31/2005 1:23:12 PM
How do I write a query to get the difference of values in a particular
column between consecutive rows. For example, from following table:
id amount
1 10
2 13
3 20
I want the result set where I want the difference between 1st and 2nd row on
amount column to be output in the res... more >>
FTP related
Posted by microsoft.public.dotnet.languages.vb at 5/31/2005 1:22:24 PM
Hi All,
I have an FTP Server where the users are sending files (say the server
name is fs1). I was wondering whether there was a way to know every two
hours that the FTP server was up writing sql codes (SQL server is
running on a different server and the server name is dbs1). If it is
down (f... more >>
inconsistancy in execution time of SP. Need help.
Posted by I.P. at 5/31/2005 12:57:24 PM
Hi,
I have a stored procedure which creates a temporary table and insert into it
selected entries.
When executing the procedure, selecting few thousands entries, it takes few
MINUTES for it to finish.
When executing the same code in the query analyzer it takes a second to
finish.
I can... more >>
Implementing custom fields
Posted by Lucas at 5/31/2005 12:53:14 PM
Hi,
Is there any recommended way / best practice to implement custom fields with
SQL Server?
I mean, I'm defining an Application DB and I'd like my app to support custom
fields. Is there any recommended way to manage this feature with SQL Server?
Thanks a lot
LucasC
... more >>
sql server vs express
Posted by John at 5/31/2005 12:51:20 PM
Hi
What is the feature comparison of sql server 2005 full and the express
product? If an application is developed on one, will it run on the other?
Can we say that express is for clients who have previously gone for ms
access?
Thanks
Regards
... more >>
Overlapping times
Posted by Serghios at 5/31/2005 12:30:49 PM
Hi All,
I have a table which logs calls called calls There are 3 main columns
user_id, starttime,endtime
I would like to run a query (a self-join i guess) which lists all
overlapping calls for a particular user_id.
In theory it should not be possible for a user to make 2 or more
sim... more >>
Rows to columns & vice versa
Posted by Blasting Cap at 5/31/2005 11:50:41 AM
I have a report that is run from a web browser, that displays the
results of a SQL stored procedure.
One of the users has asked that I transform the report - changing
nothing but wanting the rows as they are now to appear as columns, and
the columns as they are now to appear as rows.
How... more >>
what am I doing wrong with the CASE statement?
Posted by David Cho at 5/31/2005 11:29:26 AM
I have a table that stores hierarchical data. It looks like this. You
can copy and paste the text below and execute it using your SQL Query
Analyzer. Hopefully it will demonstrate the issue I am having.
********begin T-SQL code************
CREATE TABLE #hierarchy_table
( record_id INT,
... more >>
**Dynamic SQL**
Posted by M R at 5/31/2005 11:23:43 AM
Hi
I'm working with SQL 2000 and I have a table with following struncture and I
want to get the result as I described below ,but I don't know how?
PAP (PART1 NUMERIC(3) ,PART2 NUMERIC(3) ,QTY NUMERIC(2))
Primary Key (part1+part2)
part1 part2 qty
----- ------ -----
100 ... more >>
Query help (repost)
Posted by Jack at 5/31/2005 11:01:50 AM
Hello all,
Is there an elegant way to get the following output from the following data
?
Basically, I would like to list all product ids and there associated colors
in the left hand column. Across the top would be all distributors. If a
distributor carries a sku (as listed in the DistHash,... more >>
Query help
Posted by Jack at 5/31/2005 10:52:00 AM
Hello all,
Is there an elegant way to get the following output from the following data
?
Basically, I would like to list all product ids and there associated colors
in the left hand column. Across the top would be all distributors. If a
distributor carries a sku (as listed in the DistHash,... more >>
Re: Recursive rows in table and deletion (CELKO)
Posted by J-T at 5/31/2005 10:16:31 AM
CELKO,
>It takes six years to become a Union Journeyman Carpenter in New York
>State -- NOT Master Carpenter, so you would not expect to become a
>database programmer in less than ten or so years, would you? .
Well,in ten years I expect to become more knowledgable and try to learn how
I ca... more >>
divide by zero error
Posted by r at 5/31/2005 9:29:51 AM
How can I avoid this?
I have the following calculations in a view:
Data017_all.MTD_StkOrdAmt / Data017_all.MTD_TotOrdAmt * 100 AS MTD_OSO,
Data017_all.YTD_StkOrdAmt / Data017_all.YTD_TotOrdAmt * 100 AS YTD_OSO,
....if the second number (the _TotOrdAmt) is 0, I get the divide by zero
err... more >>
SQL Columns
Posted by Heath at 5/31/2005 9:18:35 AM
Hi all,
I have a table that has three fields. The first is the ID the secound is
IN_ID and the final is OUT_ID
These columns have numbers usaully 1-10 or more. If IN_ID has a value then
OUT_ID will not have a number, and the same applies the other way. If OUT_ID
has a number then IN_ID won'... more >>
Automatic Date Field
Posted by Johnny at 5/31/2005 9:14:24 AM
Hi, I am in the process of building a table and would
like one of the rows to contain a date time field that
is automatically populated with date/time once the
submit button is hit. I can do this in access with
selecting Data Type = Date/Time and default value
= Date()
SQL ver 2K sp3.
TIA... more >>
scripting table
Posted by Vincent at 5/31/2005 8:57:41 AM
Does any body know if there is a way of scripting table with the contents?
... more >>
ROLLBACK TRANSACTION
Posted by Souris at 5/31/2005 8:44:04 AM
I just wnated to know how does Rollback transaction work?
BEGIN TRANSACTION
INSERT QUERY1
INSERT QUERY2
IF @@ERROR <> 0
ROLLBACK TRANSACTION
ELSE
COMMIT TRANSACTION
If my Insert query1 fails, does Rollback all my query?
Does this code only rollback when query2 fail?
If I... more >>
Importing text from a flat text file.
Posted by ValleyBoy at 5/31/2005 8:22:01 AM
I have a DOS scripts that echo's some PC data to a local log file but instead
of writing directly to this log file i'd like the output of this script to
populate an SQL 2000 database. How would i go about redirecting the output
from a flat text file to a SQL database.
Regards
John... more >>
Smart INSERT statement
Posted by Chris Lieb at 5/31/2005 6:51:07 AM
I am parsing information out of a flat file into a table. I am trying to
make an INSERT statement that will only insert records that do not already
exist from the flat file into a table. Also, it would be nice if it could
also delete records which no longer exist in the flat file. I am not ... more >>
|