Recently I came across a scenario in which I need to validate the data against the datatype.
After some searching I found the below SQL Server Builtin functions to validate the data.
ISNULL
ISNUMERIC
ISDATE
Eg:
SELECT ISNUMERIC('1234')--Returns 1 for success and 0 for failure.
SELECT ISDATE('11-30-2010')--Returns 1 for success and 0 for failure.
If you find relevant information, please update here so that I will publish with due credit.
Regards,
DP.
Tuesday, November 30, 2010
Saturday, November 27, 2010
SQL Server Trouble shooting
Useful Technical Links
For reference:
1. SQL Server 2005/2008 and XML datatype
http://blog.sqlauthority.com/2009/02/13/sql-server-simple-example-of-reading-xml-file-using-t-sql/
http://www.kodyaz.com/articles/how-to-import-xml-into-sql-server-2005.aspx
2. Microsoft SQL Server Community Projects & Samples
http://sqlserversamples.codeplex.com/
3. Cloud computing reference:
http://en.wikipedia.org/wiki/Cloud_computing
4. SQL Server Articles
http://www.kodyaz.com/content/SQLServerArticles.aspx
1. SQL Server 2005/2008 and XML datatype
http://blog.sqlauthority.com/2009/02/13/sql-server-simple-example-of-reading-xml-file-using-t-sql/
http://www.kodyaz.com/articles/how-to-import-xml-into-sql-server-2005.aspx
2. Microsoft SQL Server Community Projects & Samples
http://sqlserversamples.codeplex.com/
3. Cloud computing reference:
http://en.wikipedia.org/wiki/Cloud_computing
4. SQL Server Articles
http://www.kodyaz.com/content/SQLServerArticles.aspx
Sunday, November 21, 2010
Use of SQLCMD
Using SSMS, we can perform T-SQL batch operations on databases.
The same can be done using SQLCMD in appropriate situations.
1. Open command prompt and type sqlcmd -? to get the available commands information
2. sqlcmd -H 'hostname' -S 'servername' -D 'database'
3. Using sqlcmd -Q 'SQL query' and sqlcmd -q 'SQL query', batch operations can be achieved.
To know more about SQLCMD, please click link here.
Hope this post helps you,
Reference: DP (http://dptechnicalblog.blogspot.com/)
The same can be done using SQLCMD in appropriate situations.
1. Open command prompt and type sqlcmd -? to get the available commands information
2. sqlcmd -H 'hostname' -S 'servername' -D 'database'
3. Using sqlcmd -Q 'SQL query' and sqlcmd -q 'SQL query', batch operations can be achieved.
To know more about SQLCMD, please click link here.
Hope this post helps you,
Reference: DP (http://dptechnicalblog.blogspot.com/)
SQL PowerShell
SSMS has the object explorer using which we we can navigate to all components of database server.
The same can be achieved using T-SQL by using sqlps.exe i.e. SQL PowerShell
Syntax:
1.From run , type sqlps.exe, a pop opens
2. type dir to explore the available directory information
3. cd SQL to get the host information
4. cd 'db server', to explore the available components
5. cd databases
6. cd 'desired database name'
Reference: DP (http://dptechnicalblog.blogspot.com/)
The same can be achieved using T-SQL by using sqlps.exe i.e. SQL PowerShell
Syntax:
1.From run , type sqlps.exe, a pop opens
2. type dir to explore the available directory information
3. cd SQL to get the host information
4. cd 'db server', to explore the available components
5. cd databases
6. cd 'desired database name'
Reference: DP (http://dptechnicalblog.blogspot.com/)
Subscribe to:
Posts (Atom)