|
|
Browse by Tags
All Tags » SQL » T-SQL
Showing page 1 of 2 (17 total posts)
-
A colleague of mine asked for a simple example to get him up and running with the basics of bitmasking. Since I had gone to the effort to create the example I thought I might as well blog it :o).
This example uses the logical AND operator &.
First of all you need to define your table.. create table BitmaskDemo
(ID int Primary ...
-
This issue caught me out today whilst putting together some build scripts for reference data. So I thought I’d share it.
USE [tempdb]
GO
CREATE TABLE [dbo].[Table_1](
[Col1] [int] IDENTITY(1,1) NOT NULL,
[Col2] [char](1) NOT NULL
) ON [PRIMARY]
GO
delete from ...
-
Following a few requests, here are some sites you may find useful for supporting your SQL learning:
General
http://www.stickyminds.com/
http://www.thefreecountry.com/documentation/onlinesql.shtml (free online tutorials)
T-SQL
http://sqlcourse.com/ (free online tutorial)
http://www.w3schools.com/sql/default.asp (free online ...
-
Today I was looking at a table with an apparantly empty column and discovered that the field is actually populated with blank spaces - Fortunately this field is of no interest to me and I noticed it purely by chance when I pasted an extract of the dat into excel and happened to notice the cell was unusually wide when I formatted the sheet. Anyway, ...
-
If you ever need to browse through a database, and dip in and out of tables to see what the data looks like, but you have very little data to go on, then you will be aware that simply running a select * against each table can be a time consuming and inefficient process. I am in this situation currently with a database that has no enforced ...
-
A colleague forwarded me this link today, which I thought would be beneficial to anyone who has to write a lot of SQL statements.
The tool will automatically format the statements to 'beautify' them, so no more excuses for 'ugly' code! Check it out here
James
-
Today I ran into a blocker when trying to do this. Having spent a reasonable amount of time taking all of my sql statements out of the OPENQUERY argument and putting them into a string variable I then found it didn't work. The reason (from BOL) it turns out is that, and I quote; "OPENQUERY does not accept variables for its ...
-
After experimentation with various datepart and datename methods following my most recent blog post, I was able to identify many if not all the necessary components for constructing a calendar table.To do this I have combined these functions with the SQL to generate a list of dates as posted by Jamie some time ago. The resultant SQL is given ...
-
Recently my colleague challenged me to find a method for identifying the week ending date for the week which any given date belongs to; i.e. say for a gven date which happens to be a Tuesday, what is the date of the end of the week? In this example, week ending is defined as a Sunday, however depending on how your server is set up, ...
-
As promised in my original post on PL/SQL date ranges previously, below is a sql statement which can be used preceeding most queries in order to apply common date range lookups to the data the query returns. SQL Server Management Studio (SSMS) doesn't have an equivalent to the '&' functionality that TOAD has to ...
1
|
|
|