Tuesday, January 31, 2012
script to grant execute to a user
SELECT 'grant execute on ' + name + ' to blahuser' AS function_name FROM sys.objectsWHERE type_desc LIKE '%FUNCTION%' or type_desc LIKE '%STORED_PROCEDURE%' ;
apply vs join
a select will work directly on a table function;likwise join syntax.
apply helps with a function that is taking a parameter - no join syntax
apply helps with a function that is taking a parameter - no join syntax
primitive expression in sql server like
for example the following will retrieve any string beging with e and having 4 trailing numbers
select ucode , ulastname, semail from person
where ucode like 'e[0-9][0-9][0-9][0-9]'
select ucode , ulastname, semail from person
where ucode like 'e[0-9][0-9][0-9][0-9]'
Thursday, January 26, 2012
code to illustrate ansi padding on one table
drop table padding
go
set ansi_padding on
create table padding (test char(10),test2 varchar(10))
go
insert into padding values('a','a')
set ansi_padding off
alter table padding add test3 char(10),test4 varchar(10)
go
insert into padding values('b','b','b','b')
set ansi_padding on
select test +'<' ,
test2 +'<' ,
test3 +'<' ,
test4 +'<'
from padding
Sunday, January 8, 2012
bitmap indices
sql server does not have this functionality- point for oracle
2nd and 3rd normal form 2 peas in the pod
2nd dictates that the column should depend on the complete key(e.i., 2 or more columns) while 3rd states that each column should not be dependant on a non-key column
Thursday, January 5, 2012
the purpose of a simple CTE in sql -server
Microsoft says "Reference the resulting table multiple times in the same statement" http://msdn.microsoft.com/en-us/library/ms190766.aspx
However, this is always true whenever you are referencing a table,since the alias will be different. What you gain is when the cte is more complicated code (joins, group by's etc) then you have to write the code only once and refer to the cte name with multiple alias'.
However, this is always true whenever you are referencing a table,since the alias will be different. What you gain is when the cte is more complicated code (joins, group by's etc) then you have to write the code only once and refer to the cte name with multiple alias'.
Subscribe to:
Posts (Atom)