Clear sql buffer and cache

Numbers Table

Rebuild indexes

Adding a foreign key

Adds foreign key in tblDisplay for lnkclientID which exists in tblClient as IDClient

 

Adding weak Link

Adds a weak link (lnkAddressID) between tbl_SUB_SubscriptionContract and tbl_SUB_Address. Conditions accepted:

- ID has to exist in tblAddress

- 0 values accepted

 

DateAdd

The DateAdd() Functions adds/subtracts a specific interval to a specified date

 

Example:

Using the DateAdd function in a loop to add 1 month to each date

SQL date time formatting

When writing queries you might sometimes come across those people clients who want the dates formatted in a certain way (pesky clients *shakes fist). Don’t stress its nothing too difficult.

Take the date 20th May 2014 and you get a request to convert this to dd/mm/yyyy.

We usually work in iso dates (yyyymmdd). For the example I will cast the iso date as a string and then cast it as a datetime and work from there.

Our final product will look something as follows:

I will go through what each of the steps entail.