all groups > sql server programming > january 2005 > threads for tuesday january 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
Time / CPU sharing
Posted by testtest at 1/25/2005 11:59:11 PM
I have a problem with sqlserver. We user server as data / transaction /
report server .
Our clients (40-50?) enters transactions. We use client server model
generally.
We use sqlserver mainly as a data server.
But we have some report stored procedures, these procesdures makes some
calculati... more >>
Can't get this select join to work...
Posted by Joe at 1/25/2005 11:50:55 PM
I get an error 'Multi-part identifier '#tmp1' could not be bound.
select #tmp1.col1 as mycol,
other columns...
from #tmp1, realtable
left join table2 on table2.id = #tmp1.col1
....
where realtable.id = table2.realtable
If I reverse the order in the from statement everything is ok but my r... more >>
Select from 4 tables with COUNT(*)
Posted by nospam NO[at]SPAM nospam.com at 1/25/2005 11:46:03 PM
Hi,
I have four tables: companies, sites, networks, ips
Here's is a statement to generate a summary from the first three tables:
SELECT dbo.Companies.Company_Name AS Company, dbo.Sites.Site_Name AS Site,
dbo.Networks.Network_IP AS Network
FROM dbo.Companies INNER JOIN dbo.Si... more >>
What is the cost of using #temp tables
Posted by Joe at 1/25/2005 10:34:07 PM
Are temp tables stored in memory or are they written to a file? Is it very
expensive to use them?
We currently have 4 being created. The 4th is utility created from the 3rd.
Once created we drop the others.
... more >>
query help sorting
Posted by Hassan at 1/25/2005 10:27:25 PM
TableA
Name Date Value
A 1/25/05 2
A 1/24/05 1
A 1/23/05 22
A 1/21/05 4
A 1/20/05 3
B 1/25/05 21
B 1/23/05 23
B 1/21/05 24
B 1/19/05 2
C 1/25... more >>
SQL Expert
Posted by Aleks at 1/25/2005 10:09:22 PM
I am doing a project and may need help from some sql expert, where can I
found someone to work as freelancer?
I may only need a couple sql statements.
Alejandro
... more >>
if i have a table with a datetime field how can i group by day and get a count of records for each day? if i group by the field it self it doesnt work
Posted by Daniel at 1/25/2005 9:34:48 PM
if i have a table with a datetime field how can i group by day and get a
count of records for each day? if i group by the field it self it doesnt
work because the hour/minute/seconds make each date unique
... more >>
Server Side Traces and Templates
Posted by Gopinath Rajee at 1/25/2005 7:40:30 PM
Hello All,
Is there a way to just use a template along with a basic script to that
would against a server ?
Someone asked me this question and I told them that the trace file that we
create using sp_trace_generateevent
sp_trace_setevent, sp_trace_setfilter, sp_trace_setstatus, sp_trace_cr... more >>
Don't see what you're looking for? Search DevelopmentNow.com.
Trace on specific table's Event
Posted by DMP at 1/25/2005 6:30:16 PM
Hi ,
How to trace on a specific Table's Event ?
means I want the trace report when pubs.Titles table
is execute (INSERT/UPDATE/DELETE Action)
Thanks
... more >>
Help
Posted by Sureshkanan at 1/25/2005 6:18:33 PM
Dear Sir,
My name is Sureshkanan working as programmer cum network
administrator. I hav been using VB 6 & Ms Sql server 7
(now 2000) for
the programs. I have so many problem to be solved. If u
don't mind,
please help me in this regard.
Problem 1.
I hav a varchar field in sql server, ... more >>
Trace question
Posted by Eric Tishkoff at 1/25/2005 5:55:02 PM
I'm setting up a trace in Query Analyzer and having an odd problem. The
entire trace script is below. It was originally created using Profiler, but
it's been modified slightly by hand.
The trace includes a filter on logical reads so that only events where
logical reads are >= 1000 should be... more >>
Extended Stored Procedures
Posted by IMRAN SAROIA at 1/25/2005 5:53:28 PM
Hi !
Please advise which libs and include files are required
to compile extended stored procedure file for SQL Server 2000
in VC++.
Thanks in advance:
... more >>
Easy aggregation question
Posted by Mark Wilden at 1/25/2005 5:34:48 PM
Given this table
CREATE TABLE SearchFieldDetail (ExpSetNo int, TableAlias char(10), Operator
char(2))
which has multiple rows for each ExpSetNo, I want to find each ExpSetNo that
has only one TableAlias among all of the same ExpSetNo rows and which has
'CC' as the Operator in all those rows... more >>
dynamic sql -- help
Posted by Pradeep Kutty at 1/25/2005 5:02:56 PM
Hi All,
Is there a way to do this?
declare @P1 varchar(100)
set @P1 = '3,5,7'
Select * from my_table where [id] in (@P1)
here the datatype of id is numeric(8,0)
and it gives me an error
Server: Msg 8114, Level 16, State 5, Line 3
Error converting data type varchar to numeric.
Than... more >>
Reverse data processed...
Posted by Smartikat at 1/25/2005 4:40:20 PM
Hi All,
I have a very big database (110GB+). It takes a long time to restore or
even just copy...
Now, I have a process that will alter a lot of data in this DB over a lot of
tables. And this process has a bug in it... In order to debug this
process, I would need to have to keep resto... more >>
Determining column names and types of recordset returned by stored procedure
Posted by Dave Hall at 1/25/2005 4:25:54 PM
How can I determine the columns that will normally be returned from a
particular stored proc without actually executing it?
I understand that a proc may return no recordset, one recordset, or multiple
recordsets, but assuming that none of my procs return more than one
recordset, is there a w... more >>
How can I use arrays in parameters.
Posted by Murat BUDAK at 1/25/2005 4:12:16 PM
Following code is just select category 1 but for example What can I do if I
want to select 1 and 2?
declare @CategoryID as int
set @CategoryID = 1
SELECT * FROM Northwind.dbo.Products WHERE CategoryID in (@CategoryID)
... more >>
Extracting SQL fields from XML Data stored in NText field
Posted by Robert Johnson at 1/25/2005 3:43:30 PM
I have a interesting situation, where XML is stored inside of SQL NText
field.
Unfortunately, I need to extract that data as SQL from the XML.
Here is the data in the BillingAddress field:
<?xml version="1.0" encoding="utf-16"?>
<Address>
<ID>-1</ID>
<FirstName>Joe</FirstName>
... more >>
Create Script
Posted by RM at 1/25/2005 3:19:55 PM
I am trying to use a script to create a table that already exists in one DB
in another DB. I used Enterprise Manager, "copied" the table and pasted it
into notepad which gave me the following script. However, I cannot get SQL
query analyzer to accept this script. Not sure what I am doing wron... more >>
query
Posted by js at 1/25/2005 3:18:35 PM
Hi, how to write a query can group customer sale by month? please help.
... more >>
Database access log
Posted by MS User at 1/25/2005 3:15:37 PM
SQL 2K
We developed a VB.NET application (SQL 2k db) where users can log into the
system and extract reports. We are planning to create a report with user
list who accessed the application in last 30 days.
Can this be achieved by querying directly to the database ??
Thanks
John
... more >>
Crosstab Query
Posted by Firmansyah at 1/25/2005 2:32:25 PM
I have a query running on MS Access like this :
TRANSFORM Count(ActivityClass) AS CountOfActivityClass
SELECT ActivityClass
FROM Category
GROUP BY ActivityClass
PIVOT Type
but how it's can be run on SQL Server, is there any function on SQL to run
the Transform function?
Thanks
... more >>
Data structure Internals Question
Posted by Ami Levin at 1/25/2005 2:26:44 PM
Hi all,
I have found that adding a column to an existing table (tested on a table
with >1M rows >200 bytes long) behaves as follows:
1. If the added column does not allow NULLs and has a DEFAULT value, the
operation actually changes the row structure.
I can see that from the time it takes t... more >>
controlling temdb size
Posted by Consultant Mark at 1/25/2005 1:53:06 PM
We have a create table query against 2 large tables (about 12 gig) that
balloons our tempdb to about 17 gigs. Is there a way to constrain the growth
of tempdb by turning off logging of some operations. The query is fairly
clean and the join and group by clauses are fully covered by indexes.... more >>
Functions and Recompile
Posted by Ryan at 1/25/2005 1:53:04 PM
Hi,
I just had a strange occurrance on one of my SQL 2000 SP3 machines. (Win 2003)
I changed the underlying table structure of two table, inserting a field in
the middle of the tables. All of the functions that referenced these did not
recompile when I next ran them. They starting giving... more >>
Stop and Start an SQL Server Remotely
Posted by pasterto NO[at]SPAM hotmail.com at 1/25/2005 1:43:58 PM
Is there a NET STOP/START command (syntax) or OSQL to stop and start an
sql server remotely on a network? I can only get it to work on my
local system and I ned to be able to do this remotely on various
servers.
... more >>
Calling external functions from SQL SELECT
Posted by A Shasore at 1/25/2005 1:23:02 PM
Does anyone know whether (and if so how :) it is possible to call external
functions from SQL's SELECT statement in a similar way that MS Access allows
you call code in its VBA modules?
For example, I'd like to be able to do this:
SELECT Name, DOB, VeryComplexFunction([Table.Numeric]) AS N... more >>
Permissions to create database diagrams...
Posted by Brett Davis at 1/25/2005 1:12:56 PM
Hello...
Am I able to grant permissions to sql server user logins to create and
manage database diagrams without making them db_owner or system
administrator? I am using SQL Server 2000. If I am able to, what do I need
to do to grant the permissions?
Please advise...
Thank you in ad... more >>
SQL Performance
Posted by tomg at 1/25/2005 1:05:02 PM
Hi,
the query with parameter
exec sp_executesql N'SELECT*FROM rplRaumEvent WHERE [rplRaumEvent_id]=@P1',
N'@P1 nvarchar(11)', @P1 = N'D0000001241'
is 10 times slower than
exec sp_executesql N'SELECT*FROM rplRaumEvent WHERE
[rplRaumEvent_id]='D0000001241'
without parameter.
Why? I w... more >>
Select record 101 to 200 ???
Posted by Joe M at 1/25/2005 12:58:08 PM
Hi I can do a select top 100 records from a table. But how do I do a
select top 101 to 200 records from a table?? Thanks
SELECT TOP 100 Names from tableDetails
how do I do 101 to 200???
... more >>
Keywords
Posted by Lionel at 1/25/2005 12:38:23 PM
Hi,
I have to build a table for something like 1.000.000 books.
I need to use keywords for each book (to be able to search with the keywords
in an intranet).
I wonder the best solution to achieve this:
*Add a new text field (varchar) and then use Full Text Search index
*Add two tables, one... more >>
FK from other database
Posted by TomislaW at 1/25/2005 12:35:20 PM
how to solve that problem?
i have 2 databases, in few tables from one database i need foreign keys from
other databases.
... more >>
Information schema
Posted by Vik at 1/25/2005 11:46:19 AM
How can I find out if a specific column is an Identity column or which
column in a specific table is the Identity column?
Thank you.
... more >>
Replacing paragraph character
Posted by Rod Gilchrist at 1/25/2005 11:38:59 AM
I've been frustrated by a query where I need to get rid of paragraph
characters within a particular column.
But dang if I can figure out how to get SQL to find the paragraph marks.
I've tried Replace(expression, chr(13), '') and the same thing with chr(10)
and vbCrLf.
Am I just stupid o... more >>
Advantage of setting isolation level to READ UNCOMMITED
Posted by Rosie at 1/25/2005 11:35:03 AM
Hi,
I have two questions.
1) What is the advantage of setting isolation level to READ UNCOMMITED if
there are noupdates for the records that we are selecting?
Does it make the select faster when we don't issue any shared lock?
2) I found this statement in books online:
'if an update a... more >>
Column rename without using sp_rename
Posted by Daniel Mihaita at 1/25/2005 11:32:18 AM
Hello,
I just need to rename a column in a database (for the moment I'm not
sure the table has data or not). The statements I need to store it in a
text file (a.sql) that is read and executed through an OleDB Connection.
I tried something like this :
alter table "table1" add ... more >>
automatic or manual ROLLBACK
Posted by Jo Segers at 1/25/2005 11:25:30 AM
Hi,
I have a job that executes the TSQL below. Do I need to do the
errorchecking myself (as below) or does the transaction automaticaly
rollback if a statement fails?
Feel free to comment on the script. (Its never too late to learn).
Yours sincerely,
Jo
SET NOCOUNT ON
SET TRANSAC... more >>
Multiple columns and row values
Posted by [Alan Flores] at 1/25/2005 11:23:03 AM
Hi. I am trying to write a single stored procedure which would trace the
changes made by a user on a table. I would like this implemented on multiple
tables having the most efficient code possible. Is it possible to browse to a
table and extract all its columns (column_name from information_sc... more >>
Possible to join a storeproc result set to normal select?
Posted by Nelson F. at 1/25/2005 10:58:18 AM
I have a rather complex storeped proc that does many calculations and
returns a row of data. Now I need to take that result set and use it along
with another result set by way of a select statement. A simplified example:
exec sp_GetAmounts @ID
returns: 100, 300, 400 , 500
select * ... more >>
uniqueidentifer convert
Posted by John at 1/25/2005 10:47:02 AM
hi i am using convert (vatchar(32), @iuid) in curosr. this cursor is trigger
whcih fire into message table.
when i am inserting, or deleteing or updating i am getting "in sufficeint
space to
convert uniqueidentifier value to char"
please advise me how to troublehoot this issue.... more >>
What exactly is a query plan (or a SQL plan for that matter)
Posted by Tim Mavers at 1/25/2005 10:45:45 AM
I have been using databases (moderately) for a while--just your basic stuff,
but I have been reading a lot of messages that reference query plan's and
SQL generates a plan... What exactly does this mean? Is there any good
reference material that covers what exactly this is?
I think I und... more >>
Bit column with NULL
Posted by David Pope at 1/25/2005 9:59:50 AM
I have this table called Location. There is a column called IsInactive. The
value can contain a NULL,0, or 1.
Why does this statement work:
SELECT * FROM Location WHERE IsInactive <> 1
I have 3 location records where IsInactive = NULL and it doesn't return
them.
Just curious.
Davi... more >>
Importing from XML - Base64 to image
Posted by shawn at 1/25/2005 9:43:13 AM
I need to exchange image data from a SQL Server database with a client using
XML. The client will also be sending me image data (converted to base 64) in
an XML document.
The export has been made very easy using the FOR XML, BINARY BASE64 clause.
However I'm having trouble with the import ... more >>
User functions or Views?
Posted by Sam Davis at 1/25/2005 9:19:02 AM
Which is faster using user defined functions to grab the element you need out
of another table or including the table as part of a view? We have an
application that uses both and would like to optimize the routines as much as
possible. ... more >>
playing around views
Posted by Kenny M. at 1/25/2005 9:05:03 AM
hi
I just want to be sure there is no way to do it inside the DB:
I have a view which return 1000 numbers and amounts like this:
Number Amount
000 234
001 3456
.... ...
999 464
I have only two very long columns. is it possible to re-arra... more >>
UDF question
Posted by Joe at 1/25/2005 8:33:02 AM
Hello,
SQL 2000 SP3a EE running on Windows 2000 server.
Instead of doing this
select f_docnumber ,CONVERT(datetime, '1/1/1970') + a.f_entrydate as date
FROM f_sw.doctaba a
I am trying to do something like this:
select f_docnumber ,dbo.testdate(f_entrydate) FROM f_sw.doctaba
The testd... more >>
Concatenate String and Pass to FORMSOF?
Posted by HumanJHawkins at 1/25/2005 7:37:29 AM
The following query works perfectly (returning all words on a list called
"Dolch" that do not contain a form of "doing"):
SELECT 'Dolch' AS [List Name], dbo.Dolch.vchWord
FROM dbo.Dolch LEFT OUTER JOIN
dbo.CombinedLexicons ON CONTAINS(dbo.Dolch.vchWord,
'FORMSOF(INFLECTIONAL, "d... more >>
Checking if user has a login
Posted by Robert Pfister at 1/25/2005 5:43:48 AM
Greetings -
I'm working with a SQL Server 2000 database via an Access front-end and I'd
like to check if the user has a login (via a pass through query I imagine) on
the database before attempting to pass the connection string. The user
login name will be the same as their PC login name ... more >>
Disabling the identity column
Posted by Rippo at 1/25/2005 4:49:46 AM
I have a table that I want to disable the identity column that will be
disabled across different sessions. I cannot use SET IDENTITY_INSERT
table off as it does not persist across columns.
I also do not want to create a tmp table without the identity being
turned on, populate it and then rena... more >>
Error in bcp of trace file
Posted by billu at 1/25/2005 4:05:02 AM
Hi, i've created a trace file which shows columns EventClass, TextData, SPID
and ServerName.
I can save this to a sql table by using profiler, save as, trace table option.
If however i try and create a bcp process to do this automatically, it keeps
on failing with:
SQLState = S1000, Nativ... more >>
modulo (check figures are rounded to nearest 10)
Posted by Steve'o at 1/25/2005 3:57:05 AM
modulo (check figures are rounded to nearest 10)
I have a couple of ideas, but they seem very heavy in traffic.
There are 20 columns in a table, where the values entered are money and need
to be rounded to the nearest 10.
About 40 concurrent users will generally be editing line by line, e... more >>
"Macro" statement
Posted by zaratino at 1/25/2005 1:41:04 AM
Is it possible to write a macro statement using Transact-SQL?
Imagine that we have a table named tblA and fields with the almost
same name, for example Field01, Field02,...Field20. (I have named
fields on that way for the better explanation).
Now, suppose that we want to do almost the same u... more >>
reset the log file size
Posted by Anuradha at 1/25/2005 1:35:04 AM
hi ,
the log file of a DB has grown in size. i need to now truncate this file and
reset the log file size.
the db has been configured for unrestricted file growth by 10% for the log
file.
how do i do this.
rgds,
anu... more >>
Need a query...
Posted by GB at 1/25/2005 12:46:52 AM
Hello,
I have a table like that:
ID | Date | Value
------------------------------------------
1 2004-12-01 12
1 2004-12-02 13
1 2004-12-03 11
2 2004-12-01 23
2 2004-12-02 21
2 2004-12-03 ... more >>
Can the usage of a Cursor dynamically generate a query statement?
Posted by Arthur at 1/25/2005 12:21:03 AM
Hi,
As far as my understanding goes, cursors can be used to fill in variables as
it iterates through a pre-defined hardcoded query.
Would like to know if I can make a dynamic query within a cursor and
subsequently
pump values obtained from this dynamic query into their respective variables... more >>
|