Create trigger for a table After Inserted
These sp creates automatically a trigger when invoked by job in SQL Server, these is very usefull and handy.
Create procedure [dbo].[sp_creates_trigger]
as
begin
declare @text nvarchar (800 ) -- Declares a variable called texto
set @text='CREATE TRIGGER [subset_trig] ON [dbo].[Subtable] AFTER INSERT AS BEGIN SET NOCOUNT ON; declare @tfield as varchar(8) set @tfiled = (select id_num from inserted)
update subtable set ufield = @tifield where customer<>''Web'' and id_num=@tfield
END'
-- set the trigger in table subtable for an action After Inserted that updates the table
exec sp_executesql @texto -- executes sp_exceutesql with the text command
end
Create procedure [dbo].[sp_creates_trigger]
as
begin
declare @text nvarchar (800 ) -- Declares a variable called texto
set @text='CREATE TRIGGER [subset_trig] ON [dbo].[Subtable] AFTER INSERT AS BEGIN SET NOCOUNT ON; declare @tfield as varchar(8) set @tfiled = (select id_num from inserted)
update subtable set ufield = @tifield where customer<>''Web'' and id_num=@tfield
END'
-- set the trigger in table subtable for an action After Inserted that updates the table
exec sp_executesql @texto -- executes sp_exceutesql with the text command
end
Google Analytics Blog: More Enterprise-Class Features Added To Google Analytics
Google Analytics Blog: More Enterprise-Class Features Added To Google Analytics
Still not available to all users but a huge step forward see the video
But we need to track an user and see what is the navigation of the content for example:
city ->New York -> Content visited
region ->California -> Content visited
Network location -> Tv Cabo Portugal-> Content visited
and so one with all the metrics including goal's, % exit's and Bounce Rate.
And with Advance segmentation it's huge step forward
Still not available to all users but a huge step forward see the video
But we need to track an user and see what is the navigation of the content for example:
city ->New York -> Content visited
region ->California -> Content visited
Network location -> Tv Cabo Portugal-> Content visited
and so one with all the metrics including goal's, % exit's and Bounce Rate.
And with Advance segmentation it's huge step forward
Email Tracking with Google Analytics
Never was so simple to track your email such as Newsletter so i am going to explain you just how easy if you already don´t know, if i make a newsletter your links have to go like these
http://jorge.m.cunha.googlepages.com/newsletter3.html?utm_source=Newsletter&utm_medium=email&utm_content=Newsletter&utm_campaign=Newsletter3
so after the your page link or your link you to add ?utm_source=Newsletter&utm_medium=email&utm_content=Newsletter&utm_campaign=Newsletter3
Then you can see the results in your Google Analytics account
Don´t forget to publish the html file in your site and include the script of Google Analytics to track your page
http://jorge.m.cunha.googlepages.com/newsletter3.html?utm_source=Newsletter&utm_medium=email&utm_content=Newsletter&utm_campaign=Newsletter3
so after the your page link or your link you to add ?utm_source=Newsletter&utm_medium=email&utm_content=Newsletter&utm_campaign=Newsletter3
- Where is green you have to made changes to your
- utm_source=Newsletter (Which action)
- utm_medium=email (Which medium)
- utm_content=Newsletter (What kind of content)
- utm_campaign=Newsletter_561 ( Which campaign)
Then you can see the results in your Google Analytics account
Don´t forget to publish the html file in your site and include the script of Google Analytics to track your page
Renaming SQL SERVER
When you need to change the name of the server in the operating system and you need to change the name of the SQL Server
- First of all Backup your databases
- select @@SERVERNAME then it returns the the name of the SQL Server
- sp_dropserver 'jmc-pc' name of the server
- go
- sp_addserver 'ws-jmc', local
- go
- repeat step 2 after restarting SQL Server to check if the name of SQL Server is OK
- More Information in http://msdn.microsoft.com/en-
us/library/ms143799.aspx
Related Posts:
How to Solve problems in SQL with Identity
Publish by
Jorge Cunha
on
21:42
Wednesday, July 30, 2008
Etiquetas:
SQL
,
SQL Identity
,
SQL Tips and Tricks
I was working with identity and i had found an problem and a solution to solve these kind of problems.
To see which number is on the identity column:
--
-- See what is the Identity in the table Articles
--
DBCC CHECKIDENT
(
articles
)
Response is:
Checking identity information: current identity value '6', current column value '6'.
DBCC execution completed. If DBCC printed error messages, contact your system administrator.
To setup with a new number on the identity column
DBCC CHECKIDENT
(
articles,reseed ,6000
)
it returns
Checking identity information: current identity value '1000', current column value '6000'.
DBCC execution completed. If DBCC printed error messages, contact your system administrator.
Note:
Don´t use truncate to delete table records it´s faster but it resets the identity column use instead the delete statement
Select Excel
Publish by
Jorge Cunha
on
20:26
Monday, July 14, 2008
Etiquetas:
Excel
,
IT Tech Guys
,
SQL
,
SQL Tips and Tricks
I am going to show on select i use to read excel files XLS
Example:
Select *
FROM OPENDATASOURCE('Microsoft.Jet.OLEDB.4.0',
'Data Source=D:\import\Excel_file.xls;Extended Properties=Excel 8.0')...Sheet1$
To do a proper use of these you must have your excel with headings and these heading must be unique and where you see Sheet1$ is the name of your sheet in your excel remember to keep these name simple and without spaces. The columns must be well formated or you don´t get the results you expect.
Help the world go to http://www.ami.pt
Crystal Reports SQL Expressions
Very nice explantion about SQL expressions in Crystal
The Crystal Reports Underground News: "Doing a SELECT in a SQL Expression field:
When teaching SQL expression fields I have always tried to stress that SQL Expressions are different from SQL Statements. A SQL Expression is a column in the report, where a SQL statement is a full query. My short version of this was to say 'a SQL Expression can't do a 'SELECT'. Well I recently learned that this is not precisely true. Under certain situations, a SQL Expression CAN do a completely separate select from the main report.
The main limitation is that it can only return a single value. So you probably will need a summary function. The following example comes from the Xtreme Sample Database:
(SELECT Max ( Orders.`Order ID`)
FROM `Orders` Orders)
Normally a CR SQL Expression would error on the SELECT, but if you put this expression in parentheses, Crystal will pass it to the database as a separate query. Amazingly, the column being queried does not even have to come from one of the tables in the report, but can be from another table in the database. In the past I would have recommended doing this via subreport. The advantage of a SQL Expression is that the value returned can be used to control things like Selecting, Sorting and Grouping in the report. To learn more about using complex SQL Expressions see my Experts Guide to SQL Expressions, Options and Commands."
The Crystal Reports Underground News: "Doing a SELECT in a SQL Expression field:
When teaching SQL expression fields I have always tried to stress that SQL Expressions are different from SQL Statements. A SQL Expression is a column in the report, where a SQL statement is a full query. My short version of this was to say 'a SQL Expression can't do a 'SELECT'. Well I recently learned that this is not precisely true. Under certain situations, a SQL Expression CAN do a completely separate select from the main report.
The main limitation is that it can only return a single value. So you probably will need a summary function. The following example comes from the Xtreme Sample Database:
(SELECT Max ( Orders.`Order ID`)
FROM `Orders` Orders)
Normally a CR SQL Expression would error on the SELECT, but if you put this expression in parentheses, Crystal will pass it to the database as a separate query. Amazingly, the column being queried does not even have to come from one of the tables in the report, but can be from another table in the database. In the past I would have recommended doing this via subreport. The advantage of a SQL Expression is that the value returned can be used to control things like Selecting, Sorting and Grouping in the report. To learn more about using complex SQL Expressions see my Experts Guide to SQL Expressions, Options and Commands."
Vista Status
Nowadays Vista has become more stable, in my
experience with Vista in English and in Portuguese I think that company's now can put in to dos list an adoption on Vista but we to consider some details first:
- Hardware
Hardware requirements to a smooth the PC's need at least 2 Gb of Ram and processor Duo core or smilar. You have to check if the hardware is Vista Compliant and check if you the drivers. You can follow these link
http://www.microsoft.com/downloads/details.aspx?
FamilyId=67240B76-3148-4E49-943D-4D9EA7F77730&displaylang=en
To do an inventory in your network such as hardware inventory, compatibility list and reporting.
For those who want to do on single XP PC you can follow these link for microsoft http://www.microsoft.com/downloads/details.aspx?
displaylang=en&FamilyID=42b5ac83-c24f-4863-a389-3ffc194924f8
- Software
In these area you to make an inventory and see if any software that you have isn't compatible with Vista and you must have a special concern regarding legacy applications.
The next step is to do pilot critical application to your business to make these transition smooth like river with no obstacles
If your site PC's are for the major Vendors you should consider to go to the vendor website.
the version of Vista that i recommend is Vista Business
of course in English, because is the most tested and native for the OS
JC
experience with Vista in English and in Portuguese I think that company's now can put in to dos list an adoption on Vista but we to consider some details first:
- Hardware
Hardware requirements to a smooth the PC's need at least 2 Gb of Ram and processor Duo core or smilar. You have to check if the hardware is Vista Compliant and check if you the drivers. You can follow these link
http://www.microsoft.com/downloads/details.aspx?
FamilyId=67240B76-3148-4E49-943D-4D9EA7F77730&displaylang=en
To do an inventory in your network such as hardware inventory, compatibility list and reporting.
For those who want to do on single XP PC you can follow these link for microsoft http://www.microsoft.com/downloads/details.aspx?
displaylang=en&FamilyID=42b5ac83-c24f-4863-a389-3ffc194924f8
- Software
In these area you to make an inventory and see if any software that you have isn't compatible with Vista and you must have a special concern regarding legacy applications.
The next step is to do pilot critical application to your business to make these transition smooth like river with no obstacles
If your site PC's are for the major Vendors you should consider to go to the vendor website.
the version of Vista that i recommend is Vista Business
of course in English, because is the most tested and native for the OS
JC
Google Custom Search and my work
Publish by
Jorge Cunha
on
20:57
Sunday, April 20, 2008
Etiquetas:
Google Custom Search
OPEN ID
The open ID it's the possibility of making sign in id to multiple sites, today i done some research and see that in web 2.0 sites is becoming more and more use of these single sign on system.
Major companies already done that the first that i know was Microsoft with passport but these product was not adopted. Nowadays is being carry on with Open Id foundation for some time, these technology is not proprietary it's open to the world.
These technology permits that you can log on the web sites without have to put again and again your login information.
more information on www.openid.net
Major companies already done that the first that i know was Microsoft with passport but these product was not adopted. Nowadays is being carry on with Open Id foundation for some time, these technology is not proprietary it's open to the world.
These technology permits that you can log on the web sites without have to put again and again your login information.
more information on www.openid.net
Now you can do Surveys
Publish by
Jorge Cunha
on
20:35
Sunday, March 16, 2008
Etiquetas:
Web Analytics
Avinash presents in these video a solution to do surveys completely free and you can customize it.
Again Avinash presents simple solution that you can try it a see your customer or visitor answering
to your What and Why question's.
Again Avinash presents simple solution that you can try it a see your customer or visitor answering
to your What and Why question's.
VISTA and Black Screen
Publish by
Jorge Cunha
on
16:34
Saturday, March 15, 2008
Etiquetas:
VISTA Black Screen
To all that already know some updates may cause some black screen on vista . The windows vista when you shutdown the machine always do a restore point, which i agree that is very good.
Remember if your PC with VISTA does not start properly use Safety mode and do a restore point, if you didn´t put some new hardware or else you have to go a see if it´s compatible with VISTA.
Remember if your PC with VISTA does not start properly use Safety mode and do a restore point, if you didn´t put some new hardware or else you have to go a see if it´s compatible with VISTA.
It Tech Guys Goes Mobile
New face into to the blog with mobile face http://ittechguys.mofuse.mobi/ like in the picture above with the help with mofuse. Nowdays i don´t have the time to post but i will go ahead with more content
Google Gphone
Publish by
Jorge Cunha
on
22:52
Monday, February 11, 2008
Etiquetas:
Google Gphone
The Gphone a video from CrunchGears in a Test. When it Goes Live? it seams very fast.
Vista SP1
Microsoft release several documentation that leave here some links.
http://www.microsoft.com/downloads/details.aspx?FamilyID=39b802ea-b2cf-4585-8cea-2cc6a6247cb3&DisplayLang=en
http://www.microsoft.com/downloads/details.aspx?familyid=D69C4E1B-C81A-41BE-B1F5-66E615BA5912&displaylang=en
Let's see if the Vista will improve his reliability and quality let's hope ....
http://www.microsoft.com/downloads/details.aspx?FamilyID=39b802ea-b2cf-4585-8cea-2cc6a6247cb3&DisplayLang=en
http://www.microsoft.com/downloads/details.aspx?familyid=D69C4E1B-C81A-41BE-B1F5-66E615BA5912&displaylang=en
Let's see if the Vista will improve his reliability and quality let's hope ....
Bill Gates Last Day Video
Publish by
Jorge Cunha
on
13:50
Tuesday, January 8, 2008
Etiquetas:
Bill Gates
Very comic video from the CES and the Last Day of Bill Gates. A Visionar person dedicated to good causes like Africa .
SQL Tips
How to identify your version of your Microsoft SQL Server, these handy query to do open a query in SQL Management Studio works on SQL2000 and 2005 ... to identify if your service packs are correctly applied
GO
use Master
SELECT SERVERPROPERTY('productversion'), SERVERPROPERTY ('productlevel'), SERVERPROPERTY ('edition')
More information in:
http://support.microsoft.com/kb/321185
GO
use Master
SELECT SERVERPROPERTY('productversion
More information in:
http://support.microsoft.com