I may have completely misunderstood what you're after but if you want to list all column names (and data types) in a database you could run this:
SELECT o.name as TableName, Column_Name, C.Data_Type
FROM dbo.sysobjects o
INNER JOIN information_schema.columns C
ON o.Name = C.Table_Name...
Thanks for your time. The syntax does’nt work but I tried your general approach of calling a function in the constraint, which seems like a good trick. Not passing any parameters but returning a count of IDs with more than one ‘On’ Bit field. The check constraint could’nt cope though and would...
Hi people.
I'd like to set a check constraint on a table that says, if the count of ON bit fields for a particular ID is greater than one then don't allow the update/insert. i.e. SELECT Count(ID) FROM tableName WHERE bitField = 1 GROUP BY ID HAVING COUNT(*) > 1
should be zero or null
I'm...
Hi.
Thanks for the reply.
Done some research. sp_MSforeachdb provides a way of looping through the databases on server and apparently carrying actions on them. I can see uses for this but I need to retrieve just the operable and fully available database names and do stuff with them.
Hi Folks.
I'm sure one of you out there must have come across this problem.
I'd like to put the names of all active databases in a cursor so I can loop through them. They have to be up and running though - not in single-user mode for example - as the query I'm using falls over when trying to...
Thanks for the prompt reply. If I was building from scratch would do what you suggest. I agree with your logic and understand what you're saying.
Unfortunately, I've inherited this system and, trust me, changing the way stored procedures are referenced is too big a task to take on right now. I...
Can anyone help please. Someone out there must already have a solution.
I regularly have to copy stored procedures from a source development database to many other databases. I do this by copying the CREATE PROCEDURE code and pasting it to all the other databases.
What I would like is a way...
Hi.
I've written a function which sets a variable (ParentWin) equal to the current window's opener. If an opener does'nt exist it opens a new window and sets the ParentWin as that. This gaurantees there's another open window that can referenced.
I've written a 2nd function, which takes two...
Hi people.
Can anyone tell me how I can convert a string into Hexadecimal values. e.g 'BaD' to '%42%61%44'. I've tried Hex() which seems to only work with numerics and ASCW(), which converts to decimal but can't seem to find anthing to do this.
The reason I'm trying to do this is I'm building...
Hello.
I'd like to constrain a table column to be either 11 numeric digits long or null. Though it's not strictly correct I can make the column Int to force numeric values but it's specifying Length within the constraint I'm having problems with. I've spent a while trying to achieve this but...
Hi, I've tweaked the functions a little bit. You should have a bit more joy now:
Here's some revised code showing a value being encrypted and decrypted:
'*** start of code ***
'encrypt function code
Function Encrypt(TheString)
Dim x, i, tmp
For i = 1 To Len( TheString )
x = Mid( Thestring...
Rocking! Thanks. Problem solved.
Should anyone else come across this article and want to find out what else the xp_sendmail stored procedure does you could try http://msdn.microsoft.com/library/default.asp?url=/library/en-us/tsqlref/ts_xp_aa-sz_6hbg.asp.
Hello.
I have a query which joins tables from 2 databases. If this query returns any records I'd like to send an email notification.
I first thought of using a DTS package but it only seems to be possible to execute a task against one connection and therefore one database at a time.
I also...
Hello.
I'm trying to create a constraint on a table which prevents null values in colummn B when the column A bit field is '1'. It seems that a contraint is the ideal way and I've tried the following.
Alter Table TableName
Add Contraint CN_ContraintName
Check
(B IS NOT NULL where A = 1)...
Hello.
I'm trying to set-up transactional replication between 2 servers. I've followed the wizard to replicate the table, am warned only tables with primary keys can be published in transactional replication, only to to find the 'specify articles' menu does not allow selection of tables with...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.