You cannot ALTER SYNONYM in SQL Server 2005: DROP and RECREATE it
Posted: February 25, 2010 Filed under: SQL Server 2005 Leave a commentYou can create SYNONYM in SQL Server 2005 with this syntax:
CREATE SYNONYM yourSynonym
FOR
[[[server.][database].][schema_name].]object_name
If you want to change a synonym, there is no ALTER command to do it. You need to DROP and CREATE it again with new context.
Here is a sample:
DROP SYNONYM [dbo].[mySynonym]
CREATE SYNONYM [dbo].[mySynonym] FOR [myDB].[dbo].[myTable]
Change parameter name with datacontrol event without using ParameterPrefix
Posted: February 24, 2010 Filed under: ASP.NET 2 Leave a commentYou can pass the original parameter value to your new parameter in your -ING event (here is DELETING) of your SqlDataSource.
You can use the same logic to do update.
<asp:SqlDataSource ID="SqlDataSource1" runat="server" OnDeleting="SqlDataSource1_Deleting" ….
Code:
{
e.Command.Parameters.Remove(e.Command.Parameters["@PartNumberID"]);
UDF for horizontal aggregate to get the minimum
Posted: February 11, 2010 Filed under: SQL Server Leave a commentCREATE
FUNCTION [dbo].[fn__horizantal_min]( @int1 int, @int2 int)returns
intas
begin
if @int1 is null
return @int2
if @int2 is null
return @int1
if @int1 < @int2
return @int1
else
return @int2
return null
end