all groups > sql server programming > september 2006 > threads for wednesday september 13
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
Lock and unlock a database
Posted by Man-wai Chang at 9/13/2006 9:42:23 PM
I would like to lock a database for exclusive access by one connection,
perform a download and off-server backup, and then unlock it to allow
users to continue their work. How could I lock and unlock the db?
--
.~. Might, Courage, Vision, SINCERITY. http://www.linux-sxs.org
/ v \ Sim... more >>
How to get the SP name in the SP?
Posted by Cylix at 9/13/2006 7:51:00 PM
I have a sp name "dbo.helloWorld"
How can I get the it's name "helloWorld" in the sp?
Thank you.
... more >>
SQL Syntax - Incorrect Syntas near '1'
Posted by Greg P. at 9/13/2006 5:08:02 PM
I have created an insert statement by concatenation in VS2005 going to
SQLSwerver 2005. If i copy the string out of my watch window and run it as a
query on my Database it works fine. If I do an execute non-query on it I the
the above error.
I have adjusted the syntax by removing all of t... more >>
T-SQL
Posted by CipherTeKST at 9/13/2006 4:23:02 PM
Having trouble using multiple subqueries to pull data from 3 DB's. What I
need in the end is the AssocName, Amount, Total1, Total2, Total3...
Here is the query...
USE DataBase1
SELECT DataBase1.dbo.Users.Name AS AssocName, Count(*) AS Amount,
(SELECT AgentFK, count(*) from DataBase2... more >>
get counts for each unique value in a column
Posted by mahalie at 9/13/2006 3:59:50 PM
I'd like to get the count for each of 24 distinct values in a table
with 3,200 records in it without having to explicitly query for each of
the distinct values. Is there some sort of "short cut" for this,
perhaps using group by? Something like...SELECT
IssueType,SUM(count(IssueType)) FROM Solv... more >>
Any need for TEXT/NTEXT column types in SQL2005
Posted by David W at 9/13/2006 3:57:58 PM
We currently have a number of columns that can store a real variety of text
length columns - typically 300 to 16000 chars, but possible more. Typically
one column per table. In SLQ2000 they were defined as TEXT columns and the
text in row value was set to 4000.
With the Varchar(max) data ... more >>
what is the code to see the all the indexes
Posted by SQL Ken at 9/13/2006 3:47:07 PM
Hi, what is the sql code to to display all the index and property of a
table?
Thanks
Ken
... more >>
Multi Record sets from SProcs
Posted by rmg66 at 9/13/2006 3:43:07 PM
SQL SERVER 2000
I have a stored procedure that returns multiple recordsets (all the same =
colums, datatypes etc...).
I need to evaluate the data in each record set.
I attempted to insert the results of the stored procedure into a temp =
table.
eg:
create table #table (col1 varchar(1000) ... more >>
Don't see what you're looking for? Search DevelopmentNow.com.
Deleting a record dynamically
Posted by Michel Racicot at 9/13/2006 3:29:54 PM
Hi there...
I have some tables and their copy:
RHUM010P and ##RHUM010P_Inserted which is basically a copy of the inserted
record in RHUM010P
Now, for each record in ##RHUM010P I need to delete each and every records
who are presents in ##RHUM010P_Inserted
The problem is:
In ##RHUM... more >>
Length too long
Posted by tshad at 9/13/2006 3:25:51 PM
I have a stored procedure that works fine.
I take the code and move it to Query analyser and I get a message saying my
Variable is too long.
********************************************************
Declare @FromDate DateTime,
@ToDate DateTime,
@Sql VarChar(8000)
Select @FromDate = '09-... more >>
Bulk Insert Unix Text files
Posted by Skip at 9/13/2006 3:25:32 PM
Hello All,
I am trying to import Unix text files into SQL Server 2005. I am having
trouble with getting this to work:
BULK INSERT MyDB.dbo.MyTable from 'c:\text.txt' WITH (fieldTERMINATOR =
' ',ROWTERMINATOR = '+CHAR(10)+',firstrow=6)
Sample Data:
ELEMENT ID Lay ... more >>
Bulk Insert To Temp Table - Security Issue
Posted by MG at 9/13/2006 2:49:02 PM
I have a stored procedure that dynamically builds a BULK INSERT command and
load data into a temp table. I can run it fine. Of course I am the dbo and
sa.
The user has BULK Administration rites setup in SQL.
I gave the user dbo access to the database because the BUILk Admin still did
not ... more >>
UPDATE TOP 1
Posted by rzaleski NO[at]SPAM gmail.com at 9/13/2006 2:26:40 PM
In SQL Server 2005, you can use the following command: UPDATE TOP 1...
SQL Server 2000 does not have this feature. Is there a way around
this? I tried using a WHERE EXISTS clause, but that didn't work.
... more >>
sql 2005 faster than 2000?
Posted by nkw at 9/13/2006 2:03:02 PM
i keep experiencing that complex queries run vastly faster than 2000 (from
about 1 hour to 2 minutes, and 2006 server is an old slower server). Does
anyone have similar experience? Or could backup/restore (rebuild index,
etc...) cause such an improvement?... more >>
Full-Text Searching
Posted by Warren at 9/13/2006 1:46:02 PM
I have installed Full-Text Searching on our SQL Server 2000 server.
Question: I have a developer that connects using a local copy of SQL Server
EM. But when he wants to add a Full-Text index, etc. The select is grayed
out. What permissions does the developer need? I thought I could give ... more >>
Is it possible to trace all statements to a specific table?...
Posted by Roz at 9/13/2006 1:38:01 PM
Hello, all. Using SQL 2005. My developers feel their app is slow due to
either non-indexed columns that should be indexed, or improperly indexed
columns. What I'm wanting to do is trace the workload against this table
for a few hours, and use this workload to determine what columns can be... more >>
Errors
Posted by FARRUKH at 9/13/2006 12:08:02 PM
I am getting these errors in my SQL Error log. I read through some articles
about changing a registry setting but I don't know what the repurcussions of
doing that would be. Can you please let me know what I need to do to stop
these errors? Thank You!
Starting up database 'model4IDR'.
Bypa... more >>
Select Right From A Specific Character
Posted by Anonymous at 9/13/2006 12:06:02 PM
I want to select the characters to the right of a dash and convert it to an
int so I can compare records in SQL 2000.
MDL-1553-AandB-083630
MDL-1553-AandB-498103
MDL-1553-AndB-00060
Would return either
083630
498103
00060
Or
83630
498103
60
Wasn't sure if I could convert a va... more >>
What am I missing with this simple query?
Posted by MarkT at 9/13/2006 11:35:02 AM
I am trying to add the results of this query to a new table using the
procedure below:
INSERT into db.TempCheckHistGN (EmpID,GrossPay,NetPay)
SELECT EmployeeID, SUM(GrossPay), as Expr1, Sum(NetPay) as Expr2 FROM
dbo.tblPACheckHist
WHERE (CheckDate Between '11/1/2005' AND '12/31/2010') AND (... more >>
Passing username to sql server from an app
Posted by JimLad at 9/13/2006 9:57:26 AM
Hi,
I have an ASP/ASP.NET app that is connecting to SQL Server 2000 with
login 'APP'. Users are logging into the app using Windows
Authentication.
What is the most generic way of passing the username through to sql
server? I don't really want to have to add it as a parameter to every
singl... more >>
Updategrams and Application Roles
Posted by JimLad at 9/13/2006 9:46:57 AM
Hi,
Does anyone know if you can use an Application Role with an updategram?
On a virtual directory.
If so, how?
Cheers,
James
... more >>
For insert trigger problem
Posted by Nader Shahin at 9/13/2006 9:33:02 AM
I have something weird happening with one of my tables.
After inserting any new record in the table and jump to the next one, a
totally different record appears instead of the one I just inserted. After
that, when I retrieved all the records again I can find my record their
stored without any... more >>
Joined Query With Optional Data
Posted by kcnsolutions NO[at]SPAM gmail.com at 9/13/2006 9:18:46 AM
Hello,
I have a table of listings, and a related table that maintains pictures
for the listings. I would like to do a single query that allows me to
return all the listings, and also the Small_Source of a picture
associated with each row if there is one (and there exists a picture
for that li... more >>
Data page storage
Posted by mrshrinkray NO[at]SPAM googlemail.com at 9/13/2006 9:14:36 AM
Can anyone tell me how data inside data pages is stored in SQL Server,
i.e. what exactly are "data pages"? I understand indexes are stored in
balanced-trees or b+ trees, each pointing to the data page. What is a
data page?
Without going into immense detail, are they a series of arrays, each
i... more >>
joining results of query to another table
Posted by Mike P at 9/13/2006 9:00:45 AM
I have the results of a query (see below) and I want join (left join)
the results of this query to another table so that I can I can get all
the records that are in the query but not in the join, and then insert
the result set into another table.
SELECT UploadDataStaging.CustomerName, Uplo... more >>
SQL search for similar records with different dates
Posted by Stanhelp at 9/13/2006 8:54:40 AM
I've created a query that joins 3 tables that needs to display only
similar records that are in year 2005 and 2006.
Current Example Results Data:
Year Name Address
------------------------------------------------
2005 ABC 95 Main St.
2005 AAA 12 Central St.
2006 ... more >>
Sequentially Numbering Groups of Records
Posted by Anonymous at 9/13/2006 8:38:02 AM
How do I sequentially number groups of records from a table in SQL Server
2000 based on a date field and OrderID. I would like to update the
SequenceID field in the table once I determine the sequential numbering.
Table:
Name,
Date,
OrderID,
SequenceID (Update this field)
Check Date f... more >>
rowset returned from sp when using sql debugger
Posted by Joe at 9/13/2006 8:18:03 AM
I give up. Does anyone know how to gaze upon the returned rowsets from a sp,
when we're stepping through that sp with the sql debugger. I using .net 2003
ide.
Not the return value, but the rowsets returned.... more >>
Different result from Script and SP
Posted by Svein Terje Gaup at 9/13/2006 7:28:43 AM
Hi, I have an SP that gives an incorrect value for one of the columns
in the result set.
I have been debugging, and so I copied the text from the SP, removed
the CREATE Procedure part, and declared/assigned the parameters their
values. When I run the exact same query in query analyzer, I get t... more >>
Table Design
Posted by george at 9/13/2006 7:14:41 AM
Hi,
I am trying to design my database to handle dynamic user input. Currently,
there is the standard order and order details design. In order details
holds the product id and other product data. Each product could have user
input that needs to be stored and the user input is different for... more >>
Set Database Context inside a stored proc
Posted by frankkirchner at 9/13/2006 6:55:01 AM
I need to use a SQL Server instance where there are about 100 databases, all
with the same schema, but each relevent to a local operating company.
The databases are named something like this, OPCO001, OPCO002, etc.
My Web App needs to call a proc that will retrieve data using the same
sele... more >>
Little bug in sql2005?
Posted by checcouno at 9/13/2006 6:31:01 AM
I found a strange behaviour in SQL 2005.
In my soterd proc i've got something like this:
/* My Code (wrong???)*/
...
if @MyVariable1 = 1
set @proD = @proD - @nCurPro + 1 +
ISNULL((SELECT SUM(ISNULL(TIP_PROFTOT, 1))
FROM RUN_MISSIONI
... more >>
Need Consecutive Query
Posted by rajalapati NO[at]SPAM gmail.com at 9/13/2006 6:28:15 AM
Hi Every body
I need a query on table which looks like
Date Unit Status
2006-07-12 Unit1 S
2006-07-13 Unit1 F
2006-07-14 unit1 F
2006-07-15 Unit1 F
2006-07-16 Unit1 S
2006-07-12 Unit1 S
2006-07-13 Unit2 F
2006-07-14 unit2 F
2006-07-15 Unit2 F
2006-07-16 Unit2 F
If it was the data ... more >>
Max lenght (8000) in string in OpenQuery
Posted by Luigi at 9/13/2006 6:13:14 AM
Hi all,
I have a OpenQuery function that in the Select statement the lenght of
it is above 8000 characters, and it get into error when I run the
query.
Is it possible to by-pass this problem?
Thanks a lot.
... more >>
Passing tableName as parameter to SP
Posted by Ann at 9/13/2006 5:51:01 AM
Hi all,
i am trying to retrieve the records based on certain column,where the
tablename as well as columname is passed as paramater.Below is the SP.It
works when i omit the where condiiton.Pls tell me where i am going wrong.
ALTER PROCEDURE [dbo].[GetDataOnID]
@TableName varchar(50),
@... more >>
Performance Question
Posted by mehdi_mousavi at 9/13/2006 4:48:22 AM
Hi folks,
Consider the following 2 queries:
Query1:
DECLARE @Min INT; SET @Min = 1;
DECLARE @Max INT; SET @Max = 100;
WITH PagedCustomerAccount AS (SELECT ROW_NUMBER() OVER (ORDER BY
CustomerAccount.AccountId) AS RowNumber,
CustomerAddress.* FROM CustomerAccount
LEFT JOIN CustomerAddress... more >>
TABLE FUNCTION
Posted by SalamElias at 9/13/2006 2:49:02 AM
CaN i USE A TABLE FUNCTION IN A sp
and USE THE TABLE RETURNED BY A FUNCTION INSTEAD OF THE TEMPORARY TABLE that
I declare in MY SP? IF YES? HOW I can do this PLEASE, I mean do, mainipulate
the table returned.
Thanks... more >>
sql statement (how to)
Posted by sampras at 9/13/2006 1:59:31 AM
I have a table with following sample records, How to select the desired
result by sql statement, any suggestion ? Thanks in advance.
Sample records
number Year qty
--------- ------- ----------
1000 2006 10
1000 [null] 20
2000 ... more >>
Generate intervals
Posted by dragos.hilbert NO[at]SPAM gmail.com at 9/13/2006 1:41:41 AM
In SQL Server 2000 I have a table:
Place
Id Place Date
1 10 2006-01-01
2 10 2006-02-01
3 20 2006-03-01
4 20 2006-04-01
5 10 2006-06-01
6 10 2006-07-01
7 10 2006-08-01
Date is always 'yyyy-MM-01', no duplicate ( Place, Date ... more >>
help me
Posted by dkv at 9/13/2006 1:21:05 AM
i got following error while executing this command
select * from tblstudentdetails where admissionno not in(select
admissionno from feepaid where date1 between ? and ?)
[Microsoft][O
DBC SQL Server Driver]COUNT field incorrect or syntax error
please give me a solution
... more >>
INSTEAD OF TRIGGERS DO NOT SUPPORT DIRECT RECURSION
Posted by Dimitris Ioannou at 9/13/2006 1:13:02 AM
3 months ago i posted a question about SQL SERVER 2005
I was migrate a SQL Server 2000 to SQL Server 2005 and the back-end code is
not function well.
I get from SQL Server 2005 the message
"INSTEAD OF TRIGGERS DO NOT SUPPORT DIRECT RECURSION. TRIGGER EXECUTION
FAILED."
I ASK AGAIN THERE ... more >>
Dynamically flattening a table
Posted by AlexT at 9/13/2006 12:25:48 AM
Hello
Probably pretty trivial and classic problem but I can't figure it
out...
I'd like to design a view to "flatten" a 1:n relation, where n is
unknown but say less than 100.
So I have
Parent 1:n Child
Where Parent is defined like
Pidx (PK)
pTxt
and Chlid as
Chidx (P... more >>
XP_CMDSHELL Problem
Posted by Jinx at 9/13/2006 12:10:01 AM
Good people,
I've searched through the Newsgroups but have not been able to find a
solution to this particular problem.
We have a number of SQL servers used by developers who claim ignorance when
things go wrong. As a consequence we now take a snap shot of who is using
the servers every... more >>
**SORT THE PHYSICAL ORDER ON A TABLE'S COLUMNS**
Posted by M at 9/13/2006 12:00:00 AM
Hi
I'm working in SQL2000 . how can I move the physical position of a column
in a table by script?
for example:
select * from table1
f1 f2 f3
---- ----- -----
desired result:
f3 f2 f1
---- ----- -----
any help would be greatly appreciated.... more >>
Explain this please!
Posted by MackS at 9/13/2006 12:00:00 AM
Hello,
I am a beginner in this SQL Programming and trying to learn everything as
quick as possible.
I came across a query below and have a very hard time in understanding it.
Specially the WHERE part of the clause.
I do not see any value "0x400" in the column Flags but it gives a result.
... more >>
problem with synonyms
Posted by bajopalabra at 9/13/2006 12:00:00 AM
hi
i have a problem when i try to
EXEC a stored procedure thru its synonym
that is : [exec synonym_to_sp]
this only happen when i do that
inside another [sp] in another db
that is
create proc [sp] as
exec [synonym_to_sp]
go
the error i get is :
"Pr... more >>
How do I GRANT TRUNCATE TABLE?
Posted by Man-wai Chang at 9/13/2006 12:00:00 AM
It kept complaining about syntax error..
--
Man-wai Chang
Softmedia Technology Co., Ltd.
Tel: (852)3583 2780... more >>
**SET NULL**
Posted by M at 9/13/2006 12:00:00 AM
hi
I'm working with SQL2000 and I want to know how can I define a "not null"
feature for a column in my table via script and vice versa.
any help would be thanked.... more >>
[sql2000] create login and create user?
Posted by Man-wai Chang at 9/13/2006 12:00:00 AM
Is there a transact SQL or system SP that could do the job?
--
Man-wai Chang
Softmedia Technology Co., Ltd.
Tel: (852)3583 2780... more >>
date
Posted by velmurugan(Internal) at 9/13/2006 12:00:00 AM
dear frenz,
If i give 12/02/2006 then i must get the total number of days
of that particular month,how to get this with sql.please help me.Also i must
get the last date
of that month as 28/02/2006..
regards,
velmurugan.D
... more >>
|