Miscellaneous

Technical Article

SQL 2K SMTP mail on Windows 2K

  • Script

SP_SQLSMTPMail is an OLE automation implementation of the CDOSYS dll for Windows 2000 which utilizes a network SMTP server rather than an Exchange server/Outlook client. The stored procedure functions similar to xp_sendmail including the ability to run a query and attach the results. No MAPI profile is required. It is also a working, detailed example […]

5 (6)

You rated this post out of 5. Change rating

2005-10-12 (first published: )

3,765 reads

Technical Article

Find and replace column constraints

  • Script

I submit this script as an example of how one might go about generating 'Alter Table' statements that find and replace specific column constraints. In my case I had to find all occurrences in a production db of suser_name() as a column constraint and replace it with suser_sname(). This script is only an example and […]

You rated this post out of 5. Change rating

2002-10-08

247 reads

Technical Article

Change the probability of the pseudo-random values

  • Script

The usual practice, when we need some test data, is to employ the pseudo-random built-in function RAND(). We usually use it to produce a random value in some range and it produces these values with the same probabilities. Sometimes we need more "realistic" data when some values are more probable than others are. In this […]

5 (1)

You rated this post out of 5. Change rating

2002-10-04

265 reads

Technical Article

INSERTS that will STAY after a ROLLBACK is issued

  • Script

Sometimes it is usefull to log stuff in SQL server while stored procs are running. If a long stored proc runs you sometimes want to be able to log a message in a loggin file. But what if a rollback occurs.... The message is lost as well.Here is a method to set up a seperate […]

You rated this post out of 5. Change rating

2002-10-01

727 reads

Technical Article

Find the Nth Occurrence of a Character in a String

  • Script

T-SQL's CHARINDEX() function is a useful for parsing out characters within a string.  However, it only returns the first occurrence of a character.  Oftentimes one needs to locate the Nth instance of a character or a space, which can be a complicated task in standard T-SQL.  This function I wrote, imaginatively named CHARINDEX2(), allows one […]

4.64 (11)

You rated this post out of 5. Change rating

2002-09-27

31,931 reads

Technical Article

Random string and random number generators

  • Script

The first part will create 2 stored procedures with self-explanatory names. The second is a standalone SQL that may be used in any stored procedure, script or DTS package.The generated string does not have any spaces and include only lower-case letters. To include anything else just change the boundaries for ASCII codes in the script.The […]

1 (1)

You rated this post out of 5. Change rating

2002-09-26

550 reads

Technical Article

Grant permissions to a role

  • Script

A very simple script that will first create a role (if it does not exist yet) and then grant full permissions on tables, views and stored procedures to the newly created role. Of course, you can add any filtering (i.e. grant permissions only for tables beginning with "abc") or grant partial permissions (SELECT or DELETE […]

You rated this post out of 5. Change rating

2002-09-26

1,121 reads

Technical Article

GET COUNT(*) from 1 table

  • Script

IN a scenario where the user would like to retrieve the Count(*) from a table without any condition, in that case this query will workselect count(*) from 'Suppose product is the table,if the product table is light then its ok but if it contains a huge data, then this query can be used.select max(rowcnt) from […]

You rated this post out of 5. Change rating

2002-09-26

323 reads

Technical Article

Find circular references in single table

  • Script

The objective is to find circular references in a single table related to itself. The script deals with a sample table Skills that have a SkilGUID (primary key) field and a SkilParentGUID field which is a foreign key to the record's parent from the same table. The number of levels in the hierarchy is not […]

3.67 (3)

You rated this post out of 5. Change rating

2002-09-24

1,080 reads

Blogs

FabCon 2025 Recap

By

Hey fellow data friends! Wow, March was an absolutely crazy month (in the best...

Privacy Policy

By

We value your privacy. This policy explains what personal data we collect and why. What...

Why use XACT_ABORT?

By

This came up one day at my work when a developer was using it....

Read the latest Blogs

Forums

Error when running SSIS package as a job

By ichervin

Hello, I've created an SSIS package that collects data from SQL Servers and databases...

Need help with Cut off time in SQL

By hollyanneu2

Hi, Need this DAX covert SQL T-SQL. Ticket Cutoff Status = VAR TimeOnly =...

Need help with Cut off time in SQL

By hollyanneu2

Hi - Currently, I have this DAX coded in Power BI Ticket Cutoff Status...

Visit the forum

Question of the Day

Browsing for Instances

I have a SQL Server instance that is not listening for connections on port 1433. By default, all ports are locked down on my server, except for the SQL Server port. What can I do to allow users to connect to the instance without knowing the port?

See possible answers