all groups > sql server programming > may 2006 > threads for friday may 12
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
Query for create table
Posted by Wallace at 5/12/2006 9:52:56 PM
Hai All,
I have table t1 in db1.
I want to create a table t1 in db2 with the same structure as t1 of
db1.
Can anyone tell me the query?
Urgent.... Looking forward for the response...
... more >>
Using output with insert (SQL2005)
Posted by Colin Dawson at 5/12/2006 7:29:20 PM
Hi all.
Here's a question that I was asked today. I'm farily confident in the
answer, but want to make sure that I've not missed something.
Here's the problem.
Create Table #CJD (
RowNum integer,
Val integer )
Insert Into #CJD( RowNum, Val ) values ( 1, 50 )
Insert Into #CJD( ... more >>
Widest table in database
Posted by Robert Bravery at 5/12/2006 4:24:12 PM
HI all,
How can I find out which is the widest table in the database
Thanks
Robert
... more >>
Trigger problem
Posted by googleRon at 5/12/2006 4:14:33 PM
Hi,
I have posted an triggerproblem some time ago, but I have met another
one which drives me crazy. (It's hard to be a rooky)
A trigger a have created on table_A that has to insert the value of
datafield_a into datafield_b of Table_B works fine.
This is the triggercode:
CREATE TRIGGER [tr... more >>
Clearing Connections
Posted by scott at 5/12/2006 4:01:29 PM
I use the below code to detach my database. Sometimes it fails because there
is an active connection. Is there any command that can overide that
protection or clear the connection without me having to manually detach
inside Ent. Manager?
CODE **********
use master
go
sp_detach_db... more >>
Global Search Criteria - 1 criteria for multiple columns
Posted by Jim Underwood at 5/12/2006 3:24:31 PM
I am curious of other's opinions on this. It may be more a UI issue than a
database one, but there is a database side to it, and I have seen that folks
here have a broader knowledge base than just proper table structures, so...
I have an application where we need to search for an employee. Yo... more >>
question about order in which queries fire in trigger
Posted by Rich at 5/12/2006 3:17:01 PM
I ran into this trigger in a project. Is this tigger firing Delete from
webproducts join Deleted... first? and then Delete from webproducts join
Inserted... second? Or is the ...join Inserted firing first and then the
....deleted?
The table SubDetail gets updated on some column, any co... more >>
How to get DMO to schedule a Stored Procedure as a Job?
Posted by Robert W. at 5/12/2006 2:31:02 PM
I have what is a simple task. Using C# I want to schedule a SQL Server
Stored Procedure to run at a specified date & time.
I've seen plenty of examples of running SQL code like this but none about
running a stored procedure. The closest I've come is this:
http://msdn.microsoft.com/library... more >>
Don't see what you're looking for? Search DevelopmentNow.com.
inserting duplicate in unique index?
Posted by lytung NO[at]SPAM gmail.com at 5/12/2006 1:46:58 PM
hi there,
what does that mean exactly? i tried to do an insert with the same
value twice and i got an error like: cannot insert duplicate key row
in object iwth unique index.??
The column is order name.
thanks
... more >>
INSERT query using linked servers is slow.
Posted by Chris F at 5/12/2006 1:20:02 PM
Good day everyone,
I am setting up a simple data mart on a server running SQL 2005. It gets
updated nightly from another server with SQL 2000. Originally both databases
were on the same server under 2000. Now that they are on different servers,
some of the INSERT queries seem to be runni... more >>
excel problem
Posted by Kevin at 5/12/2006 1:10:02 PM
hi I have an excel sheet with no header row.
so I used DTS package to transfer data to the table,
however, transform data task think my first row is the header column,
as the result, I can never transfer my first row data to the table.
is there a way to do this? maybe I have to use activex?
... more >>
Concatenate columns into a string
Posted by jdornan NO[at]SPAM wideopenwest.com at 5/12/2006 12:43:16 PM
I am trying to concatenate 3 columns into 1 string but I need to sort
them alphabetically before I concatenate them.
Example
column1 = ABC
column2 = ABF
column3 = ABE
I need to insert the concatenate value into a column as "ABC ABE ABF"
I know how to concatenate the values but I don't... more >>
Import Excel Spreadsheet
Posted by JerryWendell at 5/12/2006 12:29:02 PM
I am using TransferSpreadsheet from an ADP file to import an Excel
spreadsheet into an MSDE database. On one computer, when I run the code to
import the spreadsheet, it prompts for an SQLServer login. The same user can
try it on a different computer and it will work fine. Data in the tables... more >>
group into 1 row
Posted by Andre at 5/12/2006 11:55:56 AM
I have a query that I need to group the results for a particular client into
1 row. The problem is that I'm creating some columns on the fly using Case
statements, and the columns contain a Y or N as their data. Because of
this, I can't get the results in 1 row. I want to know if there is a... more >>
Is it possible to trigger a view by insert actions on the basetable?
Posted by googleRon at 5/12/2006 11:41:16 AM
Hello there,
Is there anybody who can help me with a problem related to triggers on
views?
Consider the following example with three objects:
table_A on database X
view_A on database Y which is a view on table A
(SELECT * FROM X.table_A)
table_B on d... more >>
In , Not In ... Exists , Not Exists .. Help Rewriting a Query
Posted by sloan at 5/12/2006 11:38:06 AM
I inherited a project, and I went thru and replaced
IN () and NOT IN () with
EXISTS ()
and NOT EXISTS.
Most places, I have had huge gains in performance, without any change in the
logic.
I'm 99% done, and when I run view some execution plans, I have found one
(hopefully last) problem child.... more >>
Deleting or Clearing
Posted by Scott at 5/12/2006 11:18:40 AM
Is there a way to delete a database log file without detaching the database?
I don't care about loosing the ability to roll back, etc.
I tried "restricting the growth" setting, but that just makes the database
unusable when it hits the limit. I'd like to be able to restrict a log file
from ... more >>
How to upload Image into table
Posted by Kris at 5/12/2006 11:08:02 AM
Hi,
I have Image file (.jpg) is saved on shared Drive. I would like to upload
into table.
How can I do that ?
Thanks
-Kris
... more >>
What is happening in background when bulk update statement is exec
Posted by babz at 5/12/2006 11:00:03 AM
Hi
I am very curious to know what is happening in background when bulk update
statement is execute? Assume that it is a very large table contains 50
million records and we are trying to update based on primary key (which is a
clustered index). ... more >>
Info!!
Posted by Vai2000 at 5/12/2006 10:47:45 AM
Hi All, 2 doubts
1. How can I retrieve the exact command (T-SQL) being executed by an SPID on
the query Analyzer. You can get the same info using Ent. Mgr and right click
on SPID.
2. What's the best technic (light weight method) to log errors from a Stored
Proc? I don't wanna use xp_cmdshell...... more >>
How often an index is hit
Posted by Tigermikefl at 5/12/2006 10:36:02 AM
Anyone have a script/process that would count how often indexes are actually
used? Are there sys optimizer tabs or logs or such?
--
Mike
If data falls in the woods and nobody is there to see it ....... ?... more >>
Update query - Marking Duplicates as Frequent
Posted by ILCSP NO[at]SPAM NETZERO.NET at 5/12/2006 10:27:30 AM
Hello, I need to create a SQL 2000 update query that needs to look for
whether a person has ordered the same item before and if so, mark all
existing records for that person and OrderType as 'frequent', except
for the first order of each type. This has to be done for all the old
records. I al... more >>
Use space after truncate
Posted by Ganesh at 5/12/2006 10:17:02 AM
Hi There,
I've done audit_log truncate using the truncate method. How can i free the
space so it can be used by operating system.
I truncated 1 billion records from audit log but still the database size
seems to be same.
--
Thanks
Ganesh... more >>
Using triggers to create audit trail
Posted by Big Ern at 5/12/2006 10:02:02 AM
I am trying to create a audit trail on some financial information in our DB's
and think that triggers would be the best way to go. I tried using C2
Auditing, but it is way to cumbersome, process intensive, and difficult to
parse out. Essentially, what I need to capture is any INSERT, UPDATE, o... more >>
How to generate the default value of datetime datatype in Tsql?
Posted by Rich at 5/12/2006 9:40:02 AM
Hello,
In MS Access, if I type
Dim d As Date
Debug.Print Year(d)
I get 1899. I believe the default value of a Tsql dateTime data type is
1/1/1900. But if I type
Declare @d datetime
Print Year(@d)
I get nothing. So how to generate the default value of a datetime datatype
in T... more >>
How to create a View from temporary table ?
Posted by kishore bondada at 5/12/2006 9:20:02 AM
Hi all,
Iam aware that #Temporary tables can not be used in creation of views, but
iam in a situation where in iam needed to do so.
can anybody provide me with a workaround for this, its very urgent.....any
help would be highly appreciated.
Thanks in advance,
Kishore... more >>
converting the varchar value to int
Posted by berggoetz NO[at]SPAM sbcglobal.net at 5/12/2006 8:52:08 AM
All,
I am running this statement and getting the error below. I am assuming
that the issue is the CLCCHRGE.CCOUNT data type is Varchar and needs to
be converted using a CONVERT clause or a CASE statement but I am not
sure I am on the right path here and if I am then I am not sure of the
syntax.... more >>
DMO, VFP and SQL 2005
Posted by Pauly C at 5/12/2006 8:42:01 AM
I have an application writing in VFP that is used to manage some database
processes, some of these processes are currently writing in DMO. We are in
the process of upgrading to sql 2005 and I’m running into some trouble. I’m
currently changing some of the process to t-sql statements but I... more >>
How to create column in existing table
Posted by amjad at 5/12/2006 8:27:02 AM
Hi i want to create a store procedure
i have table called ABC which has 10 column and have lot of data now i want
to design a store procedure to add another emplty column into that table
which i will fill with another store procedure that i already have thanks... more >>
Insert column in specific position using SQL
Posted by lmcphee at 5/12/2006 7:59:02 AM
I have a table with 4 columns.
I want to add a column to this table with an SQL command, but I want that
column added as the 2nd column - not the 5th column.
Or can I add it, and then change column order after with SQL command?
Thanks,
LMcPhee... more >>
Scheduled Backup for SQL Server express
Posted by Sam Malone at 5/12/2006 7:57:55 AM
Has anyone developed a script (that they're willing to share) that does a
scheduled backup of a SQL Server Express database and that automatically
generates a "dated" backup file - i.e. a new backup file each day as opposed
to a single one that gets overwritten?
Thanks
... more >>
How to retrieve data of a product which falls under two categories??
Posted by savvy at 5/12/2006 7:52:43 AM
I'm using MS SQL 2000. I developing a shopping cart where on the admin
side when we are inserting or updating the products, there is a chance
that a single product can fall into two categories therefore i'm giving
the users a option of CheckBoxList control for the categories. The
checkboxlist ... more >>
Logins under Windows Group
Posted by Herbert at 5/12/2006 7:11:01 AM
Hi All,
I want to get all the Logins under Particular Windows Group by using Query
or System Stored Procedure.
For Eg: All Logins under BUILTIN\Administrators
Could anyone pls help me out?
Thanks in Advance...
Regards,
Herbert R.... more >>
Left function problem
Posted by amjad at 5/12/2006 7:08:02 AM
Hi i used left function with sql server 2005 store procedure to get desire
string
liike
declare @sourceFS varchar(8000)
some string manipulation
then
SET @SourceFs=Left(@SourceFs,(Len(@SourceFs)-1)) theoritically it should
work and when i try to execute it it return that invalide param p... more >>
transaction context in use by another session error
Posted by vtxr1300 at 5/12/2006 6:36:19 AM
I have written a stored procedure that calls a C# class. The sp is
called by a trigger on table A. The class has 2 methods. Method 1 is
the main call from the stored procedure. Inside it, it sets a
connection to the db. Then it calls another private method which has
it's own connection and ... more >>
Need some help in query
Posted by amjad at 5/12/2006 5:22:01 AM
Is their best to to execute update query. here is my problem
I have a two table on different databases on sql server 2000....
one called source which has 104 fields and another called des table with
same fields...
i want to check if any thing changed in source update the destination.....
n... more >>
Views : no parameter allowed?
Posted by Stephan Hofmann at 5/12/2006 3:47:01 AM
Hello,
maybe this is really a silly question, but I have a problem with parameters
in views:
if I have created a new query saved as view within SQL server and I insert a
parameter like @abc as filter criteria, I will get an error message
parameters cannot be used in this query type.
... more >>
Rounding problem with data conversion
Posted by PaulGodfrey at 5/12/2006 2:53:02 AM
Hi,
I am trying to convert a char column so that I can subtract the values from
another column. I have tried cast and convert, to change it to decimal, but
have found that both methods round values to the nearest whole number.
The column contains money, so this is causing me to lose the p... more >>
Query user/worlstation access of database
Posted by Mark - HIS at 5/12/2006 2:42:01 AM
I have a client who needs to be able to run a query that shows a list of all
workstations (IP address, logon etc) who are currently accessing a specified
SQL database with logon / last activity time (if possible).
Most of the users are using a web application to access the database, so how
... more >>
execute a SP with a date parameter
Posted by Xavier at 5/12/2006 1:10:01 AM
hello,
i must run a SP every day with a date parameter ( a job)
examle
if today we have the 20 may 2006 - i have to run
exec mySP '20060518'
exec mySP '20060519'
that means that i run every day two times the stored procedures with the
date of the last days.
thanks
... more >>
Inserting data into multiple base tables using INSTEAD_OF_INSERT trigger
Posted by Tõnu at 5/12/2006 12:00:00 AM
Hi,
We seem to have a closed circle with updating data through views. We have
several views on MS SQL (2000) that fetch data from several base tables.
Updating and inserting the data is organised using instead of triggers. The
problem is with inserting in case several records are inserted -... more >>
Parse XML
Posted by at 5/12/2006 12:00:00 AM
In an ASP.NET 2.0 web service I need to receive XML from the client. I
figure I can simply execute a stored proc and pass the XML as a param. In
SQL Server 2000, how can I then parse that XML and split it into columns
that I can write to a table? Any advise, tutorials, etc. would be great. ... more >>
Scripting Help
Posted by news.microsoft.com at 5/12/2006 12:00:00 AM
Hi
Im fairly new to SQL Server, I need a script to create a table which
contains the following columns in a view which describes all the views in my
database and their dependent views and or tables.
ViewName DependentViewOrTableName DependentObjectType ( Table/View )
If any of ... more >>
Encrypting Text
Posted by Janet at 5/12/2006 12:00:00 AM
In SQL2K, I used to use the PWDENCRYPT() and PWDCOMPARE() to encrypt the
password and then compare when the user logs in.
In SQL 2005, seems that this function is not working, and I don't understand
the Symmetric key function. Can anyone please kindly give me some example?
Thanks in advan... more >>
Audit Insert/Update/Delete through profiler
Posted by Pushkar at 5/12/2006 12:00:00 AM
Hi,
I want to Audit Insert/Update/Delete on some of my very sensitive tables
through profiler.
My requirements are:
-I want to Audit once Insert/Update/Delete is completed successfully. So
I can not use Audit Object Permission event to audit this.
-I want number of rows affected th... more >>
|