Creating statements From excel Automatically
For Insert Statements,
="INSERT INTO DR_Prices VALUES("&A5&",'"&B5&"',"&C5&","&D5&","&E5&","&F5&","&G5&","&H5&","&I5&","&J5&","&K5&","&L5&","&M5&","&N5&","&O5&")"
If we have a requirement wherein same kind of statements needs to be created with same count of columns then they can be generated in Excel using statement,
="exec sp_addmessage @msgnum='"&A4&"',@severity='"&C4&"',@with_log='"&D4&"',@msgtext='"&E4&"'"
NOTE: Above statement is to insert into sys.messages table in Master DB. Insert statement can't be used in this case. sys.messages contains all system defined errors in all the languages supported by SQL Server.
Reference can be changed according to requirement and there my statements are!!!
Convert Function
CONVERT (data_type(length),expression,style)
data_type(length)
Mail From SP
EXEC msdb.dbo.sp_send_dbmail
@from_address = 'tejaswi_datla@horizonblue.com',
@recipients = 'tejaswi_datla@horizonblue.com',
@subject = 'test',
@body_format = 'HTML',
@body = '123456789'
For Insert Statements,
="INSERT INTO DR_Prices VALUES("&A5&",'"&B5&"',"&C5&","&D5&","&E5&","&F5&","&G5&","&H5&","&I5&","&J5&","&K5&","&L5&","&M5&","&N5&","&O5&")"
If we have a requirement wherein same kind of statements needs to be created with same count of columns then they can be generated in Excel using statement,
="exec sp_addmessage @msgnum='"&A4&"',@severity='"&C4&"',@with_log='"&D4&"',@msgtext='"&E4&"'"
NOTE: Above statement is to insert into sys.messages table in Master DB. Insert statement can't be used in this case. sys.messages contains all system defined errors in all the languages supported by SQL Server.
Reference can be changed according to requirement and there my statements are!!!
Convert Function
CONVERT (data_type(length),expression,style)
data_type(length)
Specifies the target data type (with an optional length) | |||||
expression | Specifies the value to be converted | ||||
style | Specifies the output format for the date/time |
Mail From SP
EXEC msdb.dbo.sp_send_dbmail
@from_address = 'tejaswi_datla@horizonblue.com',
@recipients = 'tejaswi_datla@horizonblue.com',
@subject = 'test',
@body_format = 'HTML',
@body = '123456789'
Comments
Post a Comment