Finding Max values of column for all the tables for SQL Server
DECLARE @DatabaseName VARCHAR(100)
DECLARE @SchemaName VARCHAR(100)
DECLARE @TableName VARCHAR(100)
DECLARE @ColumnName VARCHAR(100)
DECLARE @FullyQualifiedTableName VARCHAR(500)
DECLARE @DataType VARCHAR(50)
–Create Temp Table to Save Results
IF OBJECT_ID(‘tempdb..#Results’) IS NOT NULL
DROP TABLE #Results
CREATE TABLE #Results (
DatabaseName VARCHAR(100)
,SchemaName VARCHAR(100)
,TableName VARCHAR(100)
,ColumnName VARCHAR(100)
,ColumnDataType VARCHAR(50)
,MaxValue VARCHAR(50)
,MinValue VARCHAR(50)
)
DECLARE Cur CURSOR
FOR
SELECT DB_Name() AS DatabaseName
,s.[name] AS SchemaName
,t.[name] AS TableName
,c.[name] AS ColumnName
,'[‘ + DB_Name() + ‘]’ + ‘.[‘ + s.NAME + ‘].’ + ‘[‘ + T.NAME + ‘]’ AS FullQualifiedTableName
,d.[name] AS DataType
FROM sys.schemas s
INNER JOIN sys.tables t ON s.schema_id = t.schema_id
INNER JOIN sys.columns c ON t.object_id = c.object_id
INNER JOIN sys.types d ON c.user_type_id = d.user_type_id
WHERE is_identity = 1 –and WHERE i.is_primary_key = 1
OPEN Cur
FETCH NEXT
FROM Cur
INTO @DatabaseName
,@SchemaName
,@TableName
,@ColumnName
,@FullyQualifiedTableName
,@DataType
WHILE @@FETCH_STATUS = 0
BEGIN
DECLARE @SQL VARCHAR(MAX) = NULL
SET @SQL = ‘ Select ”’ + @DatabaseName + ”’ AS DatabaseName, ”’ + @SchemaName + ”’ AS TableName,
”’ + @TableName + ”’ AS SchemaName,
”’ + @ColumnName + ”’ AS ColumnName,
”’ + @DataType + ”’ AS ColumnName,
(Select MAX(‘ + @ColumnName + ‘) from ‘ + @FullyQualifiedTableName + ‘ with (nolock))
AS MaxValue,
(Select MIN(‘ + @ColumnName + ‘) from ‘ + @FullyQualifiedTableName + ‘ with (nolock))
AS MaxValue’
PRINT @SQL
INSERT INTO #Results
EXEC (@SQL)
FETCH NEXT
FROM Cur
INTO @DatabaseName
,@SchemaName
,@TableName
,@ColumnName
,@FullyQualifiedTableName
,@DataType
END
CLOSE Cur
DEALLOCATE Cur
SELECT *
FROM #Results
order by TableName
–drop table #Results
221 See you later with sendgrid.net
We are using sendgrid to send the emails to customers. Just yesterday, got the issues and when analyzed log, we could see 221 and 421 error with sendgrid.
The issue was the slow connection with sendgrid and due to the same, it return the error. Checked ping and tracert to smtp.sendgrid.net and getting very slow response.
Create Temporary Table in SQL Server
if you Wanted to create temporary tables without create and all stuff.
Solutins:
Select * into #TEMPTABLENAME from TABLE
550 Cannot receive from specified address : Unauthenticated senders not allowed in SendGrid
I received this while working with SendGrid. The issue was, we are not using Authentication before sending emails. Just set it up in our code and it works like charm.
Important features of MVC4
A few important updates and features of MVC4.
- Bundling and Minification, brought to ASP.NET 4.5 and now also integrated into ASP.NET MVC 4. This allows you to build faster applications by minimizing the number of requests to the server (bundling requests).
- Web API integration into ASP.NET: new support for creating HTTP REST services, has built-in support for content negotiation with support for JSON, XML and Form URL-encoded formats
- ASP.NET Mobile support through custom view engines for mobile sit.es and jQuery Mobile integration.
- Async and WebSockets: when using ASP.NET MVC 4 with .NET 4.5 and VS 11 you’ll also be able to take advantage of the new async and WebSocket support built-into .NET 4.5.
- Single Page Applications: new in the beta is support for building better end-to-end experience for building applications with client-side interactions using JavaScript (Upshot, History.js) and the MVVM pattern (knockout.js). On the server side the ASP.NET NET Web API is used, mainly an abstract class DataController. Note this is a new project template type in experimental phase.
For more information on creating Single Page Applications with ASP.NET MVC 4 I recommend you watch the fantastic session Steve Sanderson did during TechDays: Building rich Single Page Applications (SPAs) for desktop, mobile, and tablet with ASP.NET MVC 4. Worth watching until the end where Steve even shows an offline capable implementation using HTML5 application cache and offline storage. These latter ones however are not yet part of the beta.
Should I buy from RightGadgets.in? A BIG NO
Hi all,
This is just to aware you about the worst shopping experience I had with the website that is RightGadgets.in. There are many site from which I have been purchasing since last 5 years and thought to try on RightGadgets.in. I made an order with RightGadgets.in and after 10 days there are no reply back for the order I placed. Then when I get back to them using contact email, they just tell me following, Following is reply from Virendra Baradia
Tuesday, 23 August 2011 1:20 PM
Message Body
Dear sir,
Due to unavailability of stock your order is cancelled with us. We had sent a mail to you but I guess it had gone on a wrong id hence it bounced back. We sincerely regret the inconvenience caused for the same.
From: Manish Pansiniya [mailto:manish_ld@yahoo.com]
Sent: Monday, August 22, 2011 11:22 PM
To: contact@rightgadgets.in
Cc: Rightgadgets@rightflorist.co.in
Subject: Re: Rightgadgets Your Order No.: CRRGI-201108101Could you please let me know the status of my order.
Thanks,
Manish
I have purchased with many sites and I thought to experience new website but the issue is they are not mature enough to have good customer experience. I suggest you to purchase from
– Ebay
– IndiaPlaza
– Infybeam
– Tradus
And for RightGadgets.in…A BIG NO..Don’t go with it.
Outlook Addins
Good Source of outlook addins