Thursday, June 5, 2025

In MSSQL what's the different between varchar and nvarchar

In Microsoft SQL Server (MSSQL), varchar and nvarchar are both string data types used to store character data. The key difference lies in the character encoding and storage:

  • Varchar:

Uses the ASCII character set (1 byte per character).

Suitable for storing strings that contain only English characters or characters that can be represented using the ASCII character set.

Storage size is the actual length of the data entered + 2 bytes.

  • Nvarchar:

Uses the Unicode character set (2 bytes per character).

Supports a wider range of characters, including non-English languages and special characters.

Storage size is 2 times the actual length of the data entered + 2 bytes.

When deciding between varchar and nvarchar, consider the type of data you'll be storing:

  • Use varchar for English-only strings or when storage space is a concern.
  • Use nvarchar for strings that may contain non-English characters, special characters, or when supporting multiple languages is necessary. 

Flask App with DocuSign JWT integrations

 pip install Flask Flask-WTF requests

from flask import Flask, render_template, redirect, url_for

from flask_wtf import FlaskForm

from wtforms import StringField, SubmitField

from wtforms.validators import DataRequired

import requests

import json


app = Flask(__name__)

app.config['SECRET_KEY'] = 'your_secret_key'


class UserForm(FlaskForm):

    name = StringField('Name', validators=[DataRequired()])

    question = StringField('Question', validators=[DataRequired()])

    submit = SubmitField('Submit')


# DocuSign API credentials

client_id = 'your_integration_key'

client_secret = 'your_client_secret'

base_url = 'https://demo.docusign.net/restapi'


# Obtain access token

def get_access_token():

    auth_url = f'{base_url}/oauth2/token'

    headers = {'Content-Type': 'application/x-www-form-urlencoded'}

    data = {

        'grant_type': 'client_credentials',

        'client_id': client_id,

        'client_secret': client_secret

    }

    response = requests.post(auth_url, headers=headers, data=data)

    return response.json()['access_token']


# Create envelope

def create_envelope(name, question):

    access_token = get_access_token()

    envelope_url = f'{base_url}/v2.1/accounts/your_account_id/envelopes'

    headers = {

        'Authorization': f'Bearer {access_token}',

        'Content-Type': 'application/json'

    }

    data = {

        'emailSubject': 'Signature Request',

        'documents': [

            {

                'documentId': '1',

                'name': 'Signature Document',

                'fileExtension': 'pdf',

                'documentBase64': 'your_pdf_base64'  # Generate PDF base64 string

            }

        ],

        'recipients': {

            'signers': [

                {

                    'email': 'user@example.com',  # Replace with user's email

                    'name': name,

                    'recipientId': '1',

                    'tabs': {

                        'signHereTabs': [

                            {

                                'xPosition': '100',

                                'yPosition': '100',

                                'documentId': '1',

                                'pageNumber': '1'

                            }

                        ]

                    }

                }

            ]

        },

        'status': 'sent'

    }

    response = requests.post(envelope_url, headers=headers, data=json.dumps(data))

    return response.json()


@app.route('/', methods=['GET', 'POST'])

def index():

    form = UserForm()

    if form.validate_on_submit():

        name = form.name.data

        question = form.question.data

        envelope_response = create_envelope(name, question)

        # Redirect to DocuSign signing URL

        return redirect(envelope_response['url'])

    return render_template('index.html', form=form)


if __name__ == '__main__':

    app.run(debug=True)

Rocky Mount Debt Collection Application

  ## Project Overview ```bash docker build --no-cache -t zjxteusa/collection-app:v1.1.22 . docker push zjxteusa/collection-app:v1.1.2...