Browse by Tags
All Tags »
sql (
RSS)
GUERCHE Luciano E GUERCHE Luciano E 1 2 2013-05-16T19:28:00Z 2013-05-16T19:30:00Z 2 582 3322 27 7 3897 14.00 Clean false false false false EN-US X-NONE X-NONE /* Style Definitions */ table.MsoNormalTable {mso-style-name:"Tabela normal"; mso-tstyle-rowband...
IF EXISTS( SELECT * FROM dbo . sysobjects WHERE id = OBJECT_ID ( N'[dbo].[PartitionLeft]' ) AND xtype in ( N'FN' , N'IF' , N'TF' ) ) BEGIN DROP FUNCTION [dbo] . [PartitionLeft] END GO CREATE FUNCTION [dbo] . [PartitionLeft] ( @value bigint , @min bigint...
IF EXISTS( SELECT * FROM dbo . sysobjects WHERE id = object_id ( N'[dbo].[IsValidCPF]' ) AND xtype in ( N'FN' , N'IF' , N'TF' ) ) BEGIN DROP FUNCTION [dbo] . [IsValidCPF] END GO CREATE FUNCTION dbo . IsValidCPF ( @CPF varchar ( 11 ) ) RETURNS bit AS BEGIN...
Suppose I have the following query run against Pubs database SELECT employee . emp_id , employee . fname , employee . minit , employee . lname , employee . job_id , jobs . job_desc , employee . job_lvl , employee . pub_id , employee . hire_date FROM employee...
Today I had to write a SQL statement quite similar to the sample below: SELECT ProductID, ProductName, CASE WHEN ProductDescription IS NULL OR ProductDescription = '' THEN '<no description>' ELSE ProductDescription END AS ProductDescription...
Just read Roman's Weekly SQL Server Tip - Case of mistaken @@IDENTITY
Q: When I try to compile the procedure below I get the error Must declare the variable '@TableType'. Can you guess why the following stored procedure does not compile? CREATE PROCEDURE #SystemTablesAndColumns AS DECLARE @TableType TABLE (id int...
Last week, I created some scripts to move data from an old database to a new one. Some tables consisted of many fields and the old ones were not typed, that is, all fields where char, varchar, etc. INSERT INTO targetTable ( targetField1, targetField2...
Last week, I found out DA team, using ERWin to synchronize models and databases, had messed up with some foreign keys on a database I architected for an application I am developing and the FKs were missing. Then the question "How to find out which...
I generally create bit columns as NOT NULL DEFAULT dbo.BIT_NO, which in turn is a SQL server default which translates to 0. Today, I found out somebody on my team had created lots of bit fields on several tables as NULL with no default set. So I created...
More Posts
Next page »