|
Hi all!
Does anyone know if it is possible to find out if a table name already exists using SQL? and if yes what is the code?
Thanks in advance!
vero
|
|
|
|
|
veronique wrote:
Does anyone know if it is possible to find out if a table name already exists using SQL?
Yes.
veronique wrote:
and if yes what is the code?
IF EXISTS(SELECT * FROM sysobjects WHERE xtype='U' AND [name]=@name_of_table)
Do you want to know more?
|
|
|
|
|
thank you Colin!
vero
|
|
|
|
|
HI,
how could i get all the files in a directory, and list it one per one?
I need to insert the all files included in a directory, i know how to insert in database ( with textcopy ) but i dont know how to have an array with all names of files
thanks
|
|
|
|
|
Hi,
Im new to Stored Procedures and was wondering if there was answer to my question. I have created about 5 stored procedures in SQL Enterprise Manager under "Stored Procedure". One of the parameters is sp_name. Is there a way I can populate a list of the stored procedure names in a table without manually doing so. The idea being is that if the stored_procedures are updated - the table will reflect the changes without having to be manually corrected. Thanking you in advance.
|
|
|
|
|
|
I think it's safer to use the (documented) INFORMATION_SCHEMA views:
SELECT ROUTINE_NAME FROM INFORMATION_SCHEMA.ROUTINES
Grim (aka Toby) MCDBA, MCSD, MCP+SB
SELECT * FROM user WHERE clue IS NOT NULL
GO
(0 row(s) affected)
|
|
|
|
|
Grimolfr wrote:
I think it's safer to use the (documented) INFORMATION_SCHEMA views
Or the equally documented sysobjects. http://msdn.microsoft.com/library/default.asp?url=/library/en-us/tsqlref/ts_sys-o_4zll.asp[^]
And quite frankly, after using the INFORMATION_SCHEMA views earlier this year... Or should I say attempt to use them. I threw them out and refuse to use them until Microsoft come up with something that is actually useful. Have you actually looked at the source for the views - What a load of complete rubbish!
For example, this is part of the SELECT clause from the ROUTINES view:
SPECIFIC_CATALOG = db_name(),
SPECIFIC_SCHEMA = user_name(o.uid),
SPECIFIC_NAME = o.name,
ROUTINE_CATALOG = db_name(),
ROUTINE_SCHEMA = user_name(o.uid),
ROUTINE_NAME = o.name,
Why have SPECIFIC_CATALOG and ROUTINE_CATALOG? They are the same thing.
Why have SPECIFIC_SCHEMA and ROUTINE_SCHEMA? They are also the same thing.
Why have SPECIFIC_NAME and ROUTINE_NAME? It is just wasting bandwidth and processing time repeating the same data again and again.
Do you want to know more?
|
|
|
|
|
Because they may not be the same thing in, say, SQL Server 2005 (don't know, haven't bothered to fool with it yet), or the first service pack for SQL2k5.
When I tried to go to your documentation link, I got:
Page Cannot Be Found
We apologize for the inconvenience, but the page you are seeking cannot be found in this location.
My original point being that the system tables are subject to completely change their function, schema, usage, etc from one service pack to the next. The schema views aren't.
Grim (aka Toby) MCDBA, MCSD, MCP+SB
SELECT * FROM user WHERE clue IS NOT NULL
GO
(0 row(s) affected)
|
|
|
|
|
Grimolfr wrote:
When I tried to go to your documentation link, I got:
Page Cannot Be Found
Don't worry, you can find it in the SQL Server books online that come with SQL Server. In the index type sysobjects .
Grimolfr wrote:
My original point being that the system tables are subject to completely change their function, schema, usage, etc from one service pack to the next.
That's fine if you can put up with the limitations of the views. But I found them to be very restrictive and they do not return full information.
Do you want to know more?
|
|
|
|
|
"Try:
select name from dbo.sysobjects where OBJECTPROPERTY(id, N'IsProcedure') = 1 "
Worked like a treat - thanks for your help and all the associated input
|
|
|
|
|
hello, Can any body help me as how the return the ID of the row which is not deleted by a stored procedure.
Description:
I have a Table1 which is being referenced by another Table2, am sending the ID of Table1 to delete the row, due to Referential intergrity the row is not getting deleted, i want to display the id which is not getting deleted to the user in the front end how do i do this pleaseee help in this regard.
Advance Thanx.
Irsh
|
|
|
|
|
Hello every buddy,
How can I add for example some minutes to a datetime type value and get result again as a datetime?
Thank you so much,
- Den
---
"Art happens when you least expect it."
|
|
|
|
|
This example takes the current time and adds 5 minutes to it:
DATEADD(minute, 5, getdate())
The first arg is the date part (minute, hour, year, month, etc.)
The second arg is the amount you want to add (or for negative values, subtract)
The third argument is the source datetime.
Do you want to know more?
|
|
|
|
|
All I can do to appreciate now is to say thanks
---
"Art happens when you least expect it."
|
|
|
|
|
An interview question again: Please tell me what is the difference between a ADO recordset and an ADO.NET dataset?
Salil Khedkar [^]
|
|
|
|
|
Hello all!
I have created a trigger insert in a table. But I need to insert a row at a time. So every time the trigger fires, it only affects the next row, 1, 2, 3, ect. I know i can specify a a row, with a key id. But I need to make it so it goes to the next row automaticly. Any suggestions would be great!
Thanks
Rudy
|
|
|
|
|
Please clarify.
Are you saying that you need to support multirow inserts?? If so you can use @@rowcount to determine the number of rows being inserted and then use a cursor to process each row individualy.
This posting is provided "AS IS" with no warranties, and confers no rights.
Alex Korchemniy
|
|
|
|
|
Almost every example I have seen describe how to access Access database located on the local machine (C:/...)
But how do I work with Access database located on a hosted server. I would be grateful, if some can show how to connect to hosted Access databases using VS.net 2003.
Also, The follwoing command works fine with sqlCommand, but VS.net complaints when I try to use it with oleDbCommand. Any idea why?? CanI use stored procedures with Access?
INSERT INTO QR_Suppliers (SupplierName, QuestionID, Response, Comments) VALUES (@name, @question, @response, @comments)
regards
|
|
|
|
|
|
This may seem like a dumb question, but did you reboot the SQL server after you installed SP3a? And, are you installing the Reporting Services as an administrator of the SQL Server?
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Dave Kreskowiak wrote:
did you reboot the SQL server after you installed SP3a?
After installation I also reboot my machine and reboot SQL server service (at the system tray). But when I install, it still not working. But during the installation of sql sp3a I found the splash screen display sql 2000 service pack 3 not servic pack 3a. I don't know why, but I still continue because the file that I download get from the link of Microsoft Website.
Note: I used to install sql 2000 service pack 3 in the last 2 month, before I install the sp3a that i download from the internet yesterday.
Dave Kreskowiak wrote:
, are you installing the Reporting Services as an administrator of the SQL Server?
The user account that I use is the member of Administrators group. I think it is enough for me to install any application.
Any solution???
A thousand mile of journey, begin with the first step.
APO-CEDC
Save Children Norway-Cambodia Office
|
|
|
|
|
hi all,
i have a dts that copies table contents from remote server to local server.
remote table:
ItemID|name
1 |name1
2 |name22
3 |name33
local table:
ItemID|name
1 |name1
2 |name2
i want that the dts will only copy the new rows( aka. row with ItemID = 3) and leave the other rows as they are.
can any one help me create such a dts.
|
|
|
|
|
You don't really want DTS. You want replication.
using System.Beer;
|
|
|
|
|
dts and replication.. not the same?
how should i do this using replication?
please post some guide/tutorial/example.. thank you!
|
|
|
|